/// <summary>
        /// 得到最大的交易号
        /// </summary>
        public void SetMaxDeal_number()
        {
            string  str     = "select * from sale00  order by  sale_id desc";
            DataSet ds      = base.CreateDataSet(str);
            string  str2    = "select * from saletmp00  order by  sale_id desc";
            DataSet ds2     = base.CreateDataSet(str2);
            ReadIni readIni = new ReadIni("Info.ini");

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                string s   = ds.Tables[0].Rows[0]["sale_id"].ToString();
                int    num = Convert.ToInt32(s.Substring(s.Length - 4, 4));
                if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
                {
                    string s2   = ds2.Tables[0].Rows[0]["sale_id"].ToString();
                    int    num2 = Convert.ToInt32(s2.Substring(s2.Length - 4, 4));

                    if (num2 > num)
                    {
                        Info.deal_number = num2;
                        readIni.WriteString("RepastErp", "deal_number", num2.ToString());
                    }
                    else
                    {
                        Info.deal_number = num;
                        readIni.WriteString("RepastErp", "deal_number", num.ToString());
                    }
                }
                else
                {
                    Info.deal_number = num;
                    readIni.WriteString("RepastErp", "deal_number", num.ToString());
                }
            }
        }
        /// <summary>
        /// 该事件是用来更改该控件中的内部Label空间的text,需要更改的内容有交易号lblDealNum、
        /// 销售对象lblSaleKind、pos机编号lblPosNum、员工编号lblEmployeeNum和班次lblWorkNum的内容Txt
        /// </summary>
        /// <param name="DealNum">交易号</param>
        /// <param name="emp_name">员工姓名</param>
        /// <param name="PosNum">pos机编号</param>
        /// <param name="EmployeeNum">员工编号</param>
        /// <param name="WorkNum">班次</param>
        public void ChangeText(string DealNum, string emp_name, string PosNum, string EmployeeNum, string WorkNum)
        {
            //对交易号位数的判定,主界面显示交易号应该为四位
            string deal_number1 = Convert.ToString(DealNum);

            switch (deal_number1.Length)
            {
            case 1:
                deal_number1 = "000" + deal_number1;
                break;

            case 2:
                deal_number1 = "00" + deal_number1;
                break;

            case 3:
                deal_number1 = "0" + deal_number1;
                break;

            case 4: break;

            default:
                deal_number1     = "0001";
                Info.deal_number = 1;
                readIni.WriteString("RepastErp", "deal_number", "1");
                break;
            }


            this.lblDealNum.Text     = deal_number1;
            this.lblEmpName.Text     = emp_name;
            this.lblPosNum.Text      = PosNum;
            this.lblEmployeeNum.Text = EmployeeNum;
            this.lblWorkNum.Text     = WorkNum;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 下线界面中确定按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btndone_Click(object sender, EventArgs e)
        {
            isExitType     = true;
            Info.exit_date = DateTime.Now;
            //下线更新pos_rounds表(本地)
            if (InsertPos_rounds.InitController().Update_Posrounds(Info.exit_date))
            {
                //创建一个线程用于打印下线小票
                Thread thread = new Thread(new ThreadStart(Run));
                thread.Start();
                //删除提单前的空的销售单
                ChangeInfo changeinfo = new ChangeInfo();
                changeinfo.DelSaletmp00(Info.sale_id);
                ReadIni readIni = new ReadIni();
                readIni.WriteString("RepastErp", "sale_id", "");
                //删除本地临时表中符合要求的数据
                DelLocalDB dellocaldb = new DelLocalDB(this.mainForm);
                dellocaldb.DelSaletmp();

                this.Dispose();
            }
            //else
            //{
            //    MessageBox.Show("下线失败!请在本Pos机上下线。");
            //}
        }
        /// <summary>
        /// 修改密码的确定键
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            ReadIni readIni = new ReadIni();

            if (readIni.ReadString("password").Equals(oldPassWord.Text))
            {
                if (newPassWord.Text.Equals(confirm.Text))
                {
                    readIni.WriteString("password", newPassWord.Text);
                    MessageBox.Show("密码修改成功!", "提示");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("新密码与确认密码不一致!", "提示");
                    oldPassWord.Text = "";
                    newPassWord.Text = "";
                    confirm.Text     = "";
                }
            }
            else
            {
                MessageBox.Show("原始密码不正确!", "提示");
                oldPassWord.Text = "";
                newPassWord.Text = "";
                confirm.Text     = "";
            }
        }
        /// <summary>
        /// 确定按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btndone_Click(object sender, EventArgs e)
        {
            try
            {
                Info.cashier_sum = Convert.ToDecimal(cashier_sum.Text);
            }
            catch
            {
                Info.cashier_sum = 0;
            }
            Info.remain_sum = Info.cashier_sum;
            readIni         = new ReadIni("Info.ini");
            readIni.WriteString("RepastErp", "cashier_sum", Convert.ToString(Info.cashier_sum));
            readIni.WriteString("RepastErp", "remain_sum", Convert.ToString(Info.remain_sum));
            //上线时往pos_rounds表中插入相关数据
            InsertPos_rounds insertPos_rounds = InsertPos_rounds.InitController();

            insertPos_rounds.InsertPosrounds(Info.shop_id, Info.pos_id, Info.login_date, Info.cashier_sum, Info.emp_id, "0", Info.shift_num, DateTime.Now);
            this.Visible = false;
        }
 /// <summary>
 /// 向info.ini中写入信息
 /// </summary>
 /// <param name="key">关键字</param>
 /// <param name="value">值</param>
 /// <returns>成功写入返回true</returns>
 public bool WriteIniInfo(string key, string value)
 {
     try
     {
         readIniInfo.WriteString("RepastErp", key, value);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        /// <summary>
        /// 删除选中的一个商品
        /// </summary>
        /// <param name="group_prod">组商品号</param>
        /// <returns>成功删除返回true</returns>
        public bool DelGroupProd(string group_prod)
        {
            DataUpdateSales.InitDataUpdateSales().DeleteSALETMP01Comb(Info.shop_id, Info.sale_id, group_prod);
            DataSet dataSet1 = DataUpdateSales.InitDataUpdateSales().SelectAllInfo(Info.shop_id, Info.sale_id);

            if (dataSet1.Tables[0].Rows.Count == 0)
            {
                Info.sale_sno = 1;
            }
            else
            {
                Info.sale_sno = Convert.ToInt32(dataSet1.Tables[0].Rows[dataSet1.Tables[0].Rows.Count - 1][2].ToString()) + 1;
            }
            readIni.WriteString("RepastErp", "sale_sno", Info.sale_sno.ToString());
            return(this.UpdateSALETMP00());
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 关闭本窗体
        /// </summary>
        public void CloseCurrentWindow()
        {
            ReadIni readIni = new ReadIni();

            if (System.IO.File.Exists(readIni.ReadString("filePath")))
            {
                if (ci != null)
                {
                    ci.nowUnit.Text = readIni.ReadString("unitName");
                    ci.listView.Items.Clear();
                    ci.insertPanel.Visible = true;
                }
            }
            else
            {
                readIni.WriteString("filePath", "");//清空ini文件中的路径信息
                Application.Exit();
            }
            this.Close();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 点击登录按钮事件处理,判断密码是否输入正确,是否选择版本号,是否以创建数据文件。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Login_Click(object sender, EventArgs e)
 {
     if (tb_Password.Text.Equals(readIni.ReadString("password")))
     {
         if (radioButton1.Visible)
         {
             if (radioButton1.Checked == true || radioButton2.Checked == true || radioButton3.Checked == true)
             {
                 readIni.WriteString("tempversion", version);
                 FrmUnit frmUnit = new FrmUnit();
                 frmUnit.frmlogin = this;
                 frmUnit.ShowDialog();
                 if (IsSuccessful)
                 {
                     FrmMain frmMain = new FrmMain();
                     frmMain.Show();
                 }
                 this.Visible = false;
                 this.Size    = new Size(0, 0);
             }
             else
             {
                 MessageBox.Show("请选择版本号!", "提示");
             }
         }
         else
         {
             FrmMain frmMain = new FrmMain();
             frmMain.Show();
             this.Visible = false;
         }
     }
     else
     {
         MessageBox.Show("口令错误,请重新输入!");
         tb_Password.Text = "";
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        private void run1(Object path)//子线程运行的方法
        {
            ReadIni       readIni       = new ReadIni();
            UnitOperation unitOperation = new UnitOperation();

            //在指定位置创建DB文件
            string filepath = path.ToString();

            DataOperation dataOperation = new DataOperation(filepath);

            dataOperation.CreatDB(filepath);
            readIni.WriteString("filepath", filepath);

            //在系统创建的TB_LocalUnit表中插入单位(在上报端这个表中只有一条记录,在上报端它存储本系统所在单位和导入的单位)
            DataOperation dataOperation1 = new DataOperation(Application.StartupPath + "\\DB\\DBHBMSU.db");
            DataTable     dt             = dataOperation1.GetOneDataTable_sql("select * from TB_Unit where unitName='" + label_showUnit.Text + "'and unitClass='" + comboBox_select.Text.ToString() + "'"); //目的是:提取注册时间

            //获取所创建的数据文件的路径。
            unitOperation.Filepath = filepath;

            //向数据文件中插入单位信息。
            unitOperation.insterNewUnit(dt.Rows[0]["unitName"].ToString(), dt.Rows[0]["registTime"].ToString(), dt.Rows[0]["unitClass"].ToString());
            MessageBox.Show("创建成功!", "提示");
        }
        /// <summary>
        /// 向表SALETMP01插入数据
        /// </summary>
        /// <param name="saleTmp01">SaleTmp01类对象</param>
        /// <returns>bool</returns>
        public bool InsertSale01(SaleTmp01 saleTmp01)
        {
            SqlParameter[] para = new SqlParameter[25];
            para[0] = new SqlParameter("@SHOP_ID", SqlDbType.NVarChar);
            para[1] = new SqlParameter("@SALE_ID", SqlDbType.NVarChar);
            para[2] = new SqlParameter("@SALE_SNO", SqlDbType.SmallInt);
            para[3] = new SqlParameter("@PROD_ID", SqlDbType.NVarChar);
            para[4] = new SqlParameter("@SALE_PRICE", SqlDbType.Money);
            para[5] = new SqlParameter("@QTY", SqlDbType.Decimal);
            para[6] = new SqlParameter("@ITEM_DISC", SqlDbType.Money);
            para[7] = new SqlParameter("@PROM_ID", SqlDbType.NVarChar);
            para[8] = new SqlParameter("@PROM_SNO", SqlDbType.Int);
            para[9] = new SqlParameter("@PRICE_TYPE", SqlDbType.NChar);
            //para[10] = new SqlParameter("@FREE_EMP",SqlDbType.NVarChar);
            //para[10] = new SqlParameter("@FREE_MEMO",SqlDbType.SmallInt );
            para[10]      = new SqlParameter("@COMB_SALE_SNO", SqlDbType.Int);
            para[11]      = new SqlParameter("@COMB_SNO", SqlDbType.SmallInt);
            para[12]      = new SqlParameter("@COMB_TYPE", SqlDbType.NChar);
            para[13]      = new SqlParameter("@ITEM_TAX", SqlDbType.Money);
            para[14]      = new SqlParameter("@OUTINCOME", SqlDbType.Bit);
            para[15]      = new SqlParameter("@MEAL_TICKET", SqlDbType.Int);
            para[16]      = new SqlParameter("@BY_TOKEN", SqlDbType.Bit);
            para[17]      = new SqlParameter("@RELATE_PROD", SqlDbType.NVarChar);
            para[18]      = new SqlParameter("@SALE_ORGINAL_PRICE", SqlDbType.Decimal);
            para[19]      = new SqlParameter("@ITEM_DISC_TOT", SqlDbType.Decimal);
            para[20]      = new SqlParameter("@ACT_PRICE", SqlDbType.Decimal);
            para[21]      = new SqlParameter("@ISPROM", SqlDbType.Bit);
            para[22]      = new SqlParameter("@GROUP_PROD", SqlDbType.NVarChar);
            para[23]      = new SqlParameter("@STATUS_ID", SqlDbType.NChar);
            para[24]      = new SqlParameter("@TRANSFER_STATUS", SqlDbType.NChar);
            para[0].Value = saleTmp01.Shop_id;
            para[1].Value = saleTmp01.Sale_id;
            para[2].Value = saleTmp01.Sale_sno;
            Info.sale_sno++;
            readIni.WriteString("RepastErp", "sale_sno", Info.sale_sno.ToString());
            para[3].Value = saleTmp01.Prod_id;
            para[4].Value = saleTmp01.Sale_price;
            para[5].Value = saleTmp01.Qty;
            para[6].Value = saleTmp01.Item_disc;
            para[7].Value = saleTmp01.Prom_id;
            para[8].Value = saleTmp01.Prom_sno;
            para[9].Value = saleTmp01.Price_type;
            //para[10] .Value =saleTmp01.Free_emp ;
            //para[10] .Value =saleTmp01.Free_memo;
            para[10].Value = saleTmp01.Comb_sale_sno;
            para[11].Value = saleTmp01.Comb_sno;
            para[12].Value = saleTmp01.Comb_type;
            para[13].Value = saleTmp01.Item_tax;
            para[14].Value = saleTmp01.Outincome;
            para[15].Value = saleTmp01.Meal_ticket;
            para[16].Value = saleTmp01.By_token;
            para[17].Value = saleTmp01.Relate_prod;
            para[18].Value = saleTmp01.Sale_orginal_price;
            para[19].Value = saleTmp01.Item_disc_tot;
            para[20].Value = saleTmp01.Act_price;
            para[21].Value = saleTmp01.Isprom;
            para[22].Value = saleTmp01.Group_prod;
            para[23].Value = saleTmp01.Status_id;
            para[24].Value = saleTmp01.Transfer_status;

            // 向表SALETMP01中插入数据
            string sql = "INSERT INTO SALETMP01 ( SHOP_ID, SALE_ID, SALE_SNO, PROD_ID, SALE_PRICE, "
                         + "QTY, ITEM_DISC,PROM_ID,PROM_SNO, PRICE_TYPE ,"
                         + "COMB_SALE_SNO,COMB_SNO,COMB_TYPE,"
                         + "ITEM_TAX,OUTINCOME, MEAL_TICKET,BY_TOKEN,RELATE_PROD,"
                         + "SALE_ORGINAL_PRICE, ITEM_DISC_TOT,ACT_PRICE,ISPROM,GROUP_PROD,"
                         + "STATUS_ID,TRANSFER_STATUS"
                         + "  ) "
                         + "VALUES(	@SHOP_ID, @SALE_ID, @SALE_SNO, @PROD_ID, @SALE_PRICE, "
                         + "@QTY, @ITEM_DISC,@PROM_ID,@PROM_SNO, @PRICE_TYPE ,"
                         + "@COMB_SALE_SNO,@COMB_SNO,@COMB_TYPE,"
                         + "@ITEM_TAX,@OUTINCOME, @MEAL_TICKET,@BY_TOKEN,@RELATE_PROD,"
                         + "@SALE_ORGINAL_PRICE, @ITEM_DISC_TOT,@ACT_PRICE,@ISPROM,@GROUP_PROD,"
                         + "@STATUS_ID,@TRANSFER_STATUS"
                         + " )";

            // 调用父类的方法DBSql.RunSql将数据插入到SALETMP01
            return(base.RunSQL(sql, para));
        }
        /// <summary>
        /// 如果满足条件,清空交班点时间
        /// </summary>
        public void ClearTime()
        {
            //交班点
            int timePoint;
            //上次上线时间
            DateTime preLoginTime;
            //交班时间
            DateTime changeWorkTime;
            //本次登录时间
            DateTime nowLoginTime = DateTime.Now;

            try
            {
                preLoginTime = Convert.ToDateTime(readIni.ReadString("RepastErp", "preLoginTime"));
                //changeWorkTime = Convert.ToDateTime(readIni.ReadString("RepastErp", "changeWorkTime"));
                //timePoint = Convert.ToInt32(changeWorkTime.Hour);
            }
            catch { return; }

            //截取空格后的字符串
            // string s1 = changeWorkTime.ToString();
            //string s2 = s1.Substring(s1.IndexOf(" ") + 1);
            string s2 = readIni.ReadString("RepastErp", "changeWorkTime");

            timePoint = Convert.ToInt32(s2.Substring(0, 2));
            if (timePoint >= 0 && timePoint <= 6)
            {
                //截取空格前的字符串
                string s3 = nowLoginTime.ToString();
                string s4 = s3.Substring(0, s3.IndexOf(" "));
                string s  = s2 + " " + s4;
                //若交班时间是凌晨以后,则交班时间的年月日跟当前时间相同
                changeWorkTime = Convert.ToDateTime(s);
            }
            else
            {
                //截取空格前的字符串
                string s3 = preLoginTime.ToString();
                string s4 = s3.Substring(0, s3.IndexOf(" "));
                string s  = s2 + " " + s4;
                //若交班时间是凌晨以前,则交班时间的年月日跟上次登录时间相同
                changeWorkTime = Convert.ToDateTime(s);
            }

            //如第二次上线时间大于交班时间
            if (DateTime.Compare(nowLoginTime, changeWorkTime) >= 0 && DateTime.Compare(changeWorkTime, preLoginTime) >= 0)
            {
                //清空配置文件config.ini中的班次
                readIni.WriteString("RepastErp", "workNumber", "0");
                //清空Info.ini配置文件中的交易号
                ReadIni readIni1 = new ReadIni("Info.ini");
                readIni1.WriteString("RepastErp", "deal_number", "1");
                ReadIni readIniInfo = new ReadIni("Info.ini");
                readIniInfo.WriteString("RepastErp", "isNormalOff", "true");
                string oldSaleId = readIniInfo.ReadString("RepastErp", "sale_id");
                try
                {
                    DBSql.SRunSQL("delete saletmp00 where sale_id=" + oldSaleId + "");
                    DBSql.SRunSQL("delete saletmp01 where sale_id=" + oldSaleId + "");
                    DBSql.SRunSQL("delete saletmp02 where sale_id=" + oldSaleId + "");
                }
                catch { }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 点击创建数据文件的事件的处理,创建数据文件。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_sure_Click(object sender, EventArgs e)
        {
            try
            {
                ReadIni readini = new ReadIni();
                if (!label_showUnit.Text.Equals("") && !label_showUnit.Text.Equals(string.Empty))
                {
                    saveFileDialog1.Filter = ".hbs文件|*.hbs";
                    string newPath = "C:\\HBGB";
                    if (!Directory.Exists(newPath))
                    {
                        Directory.CreateDirectory(newPath);
                    }
                    saveFileDialog1.InitialDirectory = newPath;
                    saveFileDialog1.FileName         = label_showUnit.Text;
                    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        this.ControlBox = false;

                        button_sure.Enabled = false;

                        button_regist.Enabled = false;

                        comboBox_select.Enabled = false;

                        listView1.Enabled = false;

                        string filepath = saveFileDialog1.FileName.ToString();

                        Object path = (Object)filepath;//把filePath转换为object的对象
                        run1(path);

                        readini.WriteString("unitName", label_showUnit.Text);

                        readini.WriteString("unitClass", comboBox_select.Text.ToString());

                        string s = readini.ReadString("tempversion");

                        if (s != "")
                        {
                            //记录版本
                            readini.WriteString("version", s);
                            readini.WriteString("tempversion", "");
                        }
                        if (!LoginMain)
                        {
                            frmlogin.IsSuccessful = true;
                        }

                        if (System.IO.File.Exists(readini.ReadString("filePath")))
                        {
                            if (ci != null)
                            {
                                ci.nowUnit.Text = label_showUnit.Text;
                                ci.listView.Items.Clear();
                                ci.insertPanel.Visible = true;
                            }
                        }
                        else
                        {
                            readini.WriteString("filePath", "");//清空ini文件中的路径信息
                            Application.Exit();
                        }
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("单位选择不能为空", "提示");
                }
            }
            catch (Exception)
            {
            }
        }