예제 #1
0
        private void PackCollect_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(db.IniReadValuePivas("TimeShowType", "IsshowHS")))
            {
                db.IniWriteValuePivas("TimeShowType", "IsshowHS", "1");
                isshowHS = "1";
            }
            else
            {
                isshowHS = db.IniReadValuePivas("TimeShowType", "IsshowHS");
            }
            datetimeType();

            bddvg();
            bdbatch();
            dbcob();

            //foreach (Control ctr in panel2.Controls)
            //{
            //    if (ctr is CheckBox)
            //    {
            //        CheckBox cb = ctr as CheckBox;
            //        cb.Checked = true;
            //    }
            //}
            //if (checkedListBox1.Items.Count != 0) {
            //    this.button1_Click(null, null);
            //}
        }
예제 #2
0
        private void PIVASMate_Load(object sender, EventArgs e)
        {
            try
            {
                this.ControlBox  = false;
                this.Text        = this.Text + " (" + EmpName + ")";
                this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                this.WindowState = FormWindowState.Maximized;

                NowDate.Text = "PIVAS MATE 3.0 " + DateTime.Now.ToString();
                FormPath(DEmployeeID);
                labelLoginer.Text = EmpName + "(" + EmpCode + ")";

                //*****************张建双2014-07-16**********************//
                try
                {
                    IniRemTime = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "RemindTime")) * 60;
                    keeptime   = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "KeepTime"));
                    remindtime = IniRemTime;
                }
                catch
                {
                    IniRemTime = 180;
                    remindtime = IniRemTime;
                    keeptime   = 5;
                    dbHelp.IniWriteValuePivas("Remind", "RemindTime", "3");
                    dbHelp.IniWriteValuePivas("Remind", "KeepTime", "5");
                }

                //判断气泡消息框是否可用
                if (dbHelp.GetPivasAllSet("主画面_气泡消息框") == "0")
                {
                    QiPao = true;//执行不可用
                }
                else
                {
                    QiPao = false;
                }

                //判断气泡消息框是否可用
                if (dbHelp.GetPivasAllSetValue2("主画面_气泡消息框") == "0")
                {
                    QiPaoShuangJi = true;//执行不可用
                }
                else
                {
                    QiPaoShuangJi = false;
                }

                ShanShuo();
            }
            catch (Exception ex)
            {
                ShowMsgHelper.ShowError("主窗体加载出错:" + ex.Message);
            }
        }
예제 #3
0
 private void AddCondition_Load(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(db.IniReadValuePivas("ConsumableIsCharge", "ChargeValue")))
     {
         db.IniWriteValuePivas("ConsumableIsCharge", "ChargeValue", "-1");
     }
     else
     {
         textBox1.Text = db.IniReadValuePivas("ConsumableIsCharge", "ChargeValue");
     }
 }
예제 #4
0
        private string Datebase()
        {
            SqlConnectionStringBuilder buf = new SqlConnectionStringBuilder();
            string SqlSerPort = dbHelp.IniReadValuePivas("Database", "SqlSerPort").Trim();

            buf.DataSource     = "." + (string.IsNullOrEmpty(SqlSerPort) ? string.Empty : "," + SqlSerPort);
            buf.InitialCatalog = dbHelp.IniReadValuePivas("Database", "InitialCatalog").Trim();
            buf.UserID         = Decrypt(dbHelp.IniReadValuePivas("Database", "UserID")).Trim();
            buf.Password       = Decrypt(dbHelp.IniReadValuePivas("Database", "Password")).Trim();

            buf.InitialCatalog = string.IsNullOrEmpty(buf.InitialCatalog) ? "Pivas2014" : buf.InitialCatalog;
            buf.UserID         = string.IsNullOrEmpty(buf.UserID) ? "laennec" : buf.UserID;
            buf.Password       = string.IsNullOrEmpty(buf.Password) ? "13816350872" : buf.Password;
            return(buf.ConnectionString);
        }
예제 #5
0
        private void QrUserCode_Load(object sender, EventArgs e)
        {
            try
            {
                comboBox1.SelectedIndex = 0;
                db = new DB_Help();
                string ir = db.IniReadValuePivas("Printer", "EmpReportWe");
                comboBox2.SelectedIndex = string.IsNullOrEmpty(ir) ? 0 : Convert.ToInt32(ir);
                //if (db.GetPIVAsDB(string.Format("SELECT [LimitName] FROM [dbo].[ManageLimit] where [DEmployeeID]='{0}' and LimitName='QrUserCode'", User)).Tables[0].Rows.Count == 0)
                if (!GetPivasLimit.Instance.Limit(User, "QrUserCode"))
                {
                    this.Dispose(true);
                }
                string sql = "  select *from DEmployee";

                demploy                = db.GetPIVAsDB(sql).Tables[0];
                listBox1.DataSource    = demploy;
                listBox1.DisplayMember = "DEmployeeCode";
                listBox1.ValueMember   = "DEmployeeCode";
                textBox1.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #6
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            try
            {
                HideShow(true);
                listener.Start();

                int port = Int32.Parse(db.IniReadValuePivas("SCREEN", "ServerPort").Trim());
                tcpServer                  = new ScreenTcpServer(port);
                tcpServer.Connected       += TcpServer_Connected;
                tcpServer.Disconnected    += TcpServer_Disconnected;
                tcpServer.ErrorOccurred   += TcpServer_ErrorOccurred;
                tcpServer.EventLogin      += TcpServer_EventLogin;
                tcpServer.EventScreenInfo += TcpServer_EventScreenInfo;
                tcpServer.Started         += TcpServer_Started;
                tcpServer.Stopped         += TcpServer_Stopped;
                tcpServer.Start();

                controller = new ScreenController(tcpServer);
                controller.ListenStarted += TcpServer_Started;
                controller.ListenStoped  += TcpServer_Stopped;
                foreach (ColumnHeader ch in listViewDrug.Columns)
                {
                    ch.Width = -2;
                }
                //InitListview();
                //ShowTipCenter();
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("主窗体加载失败" + ex.Message);
            }
        }
예제 #7
0
        /// <summary>
        /// 调用接口前需初始化参数;
        /// 从数据库或配置文件中加载配置
        /// </summary>
        /// <returns></returns>
        private static bool InitConfig()
        {
            try
            {
                loadalready();
                IsOtherLabel = dbHelp.GetPivasAllSet("第三方瓶签");//获取第三方瓶签的设置

                if (IsOtherLabel == "1")
                {
                    LabelLength = int.Parse(dbHelp.GetPivasAllSetValue2("第三方瓶签")); //获取瓶签长度
                    LabelBS     = dbHelp.GetPivasAllSetValue3("第三方瓶签");            //获取瓶签标识
                    InternalLogger.Log.Debug("LabelLength" + LabelLength.ToString() + "LabelBS" + LabelBS.ToString());
                }

                //读取计费配置值并获取接口对象
                IsCharge = dbHelp.IniReadValuePivas("Charge", "PZ") == "1";
                #region 测试
                charge = ChargeFactory.GetCharge(HOSPITAL_TYPE);
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("初始化发生错误,请检查配置;" + ex.Message);
            }
            return(false);
        }
예제 #8
0
 public Information()
 {
     InitializeComponent();
     #region csw修改,需要此exe下配置文件IMEQPIVAs.ini
     bPre = ChargeFactory.GetCharge(dbHelp.IniReadValuePivas("Charge", "HospitalType"));
     #endregion
 }
예제 #9
0
        private DB_Help db     = new DB_Help(); //用于读取配置文件

        public ScreenController(ScreenTcpServer screenTcpServer)
        {
            this.screenTcpServer = screenTcpServer;

            FAIL_COUNT = Int32.Parse(db.IniReadValuePivas("SCREEN", "FailCount").Trim());

            checkServerStatus = new Thread(CheckServerStatus);
            checkServerStatus.IsBackground = true;
            checkServerStatus.Start();
        }
예제 #10
0
        private void GetConsum()
        {
            string ischarge = string.Empty;

            if (string.IsNullOrEmpty(db.IniReadValuePivas("ConsumableIsCharge", "ChargeValue")))
            {
                db.IniWriteValuePivas("ConsumableIsCharge", "ChargeValue", "-1");
                ischarge = "-1";
            }
            else
            {
                ischarge = db.IniReadValuePivas("ConsumableIsCharge", "ChargeValue");
            }
            string sql = string.Format("exec bl_ConsumablesStatistics '{0}','{1}',{2}"
                                       , dateTimePicker1.Value.ToString("yyyy-MM-dd") + " 00:00:00", dateTimePicker2.Value.ToString("yyyy-MM-dd") + " 23:59:00", ischarge);
            DataSet ds = db.GetPIVAsDB(sql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                dtprint = ds.Tables[0];


                foreach (DataRow dr in dtprint.Rows)
                {
                    int a = 0;
                    for (int i = 3; i < dr.ItemArray.Length; i++)
                    {
                        a = a + Convert.ToInt32(dr[i]);
                    }
                    dr["总计"] = a;
                }
            }
            else
            {
                if (dtprint != null)
                {
                    dtprint.Rows.Clear();
                }
                MessageBox.Show("此段时间没有耗材数据!");
            }
        }
예제 #11
0
파일: Login.cs 프로젝트: ewin66/wholePivas
 /// <summary>
 /// 从本地读取病区
 /// </summary>
 protected bool RedWard()
 {
     try
     {
         if (db.IniReadValuePivas("User", "Ward") != null && db.IniReadValuePivas("User", "Ward") != "")
         {
             txt_word.Text    = db.IniReadValuePivas("User", "Ward");
             cob_word.Text    = db.IniReadValuePivas("User", "Ward");
             cob_word.Visible = false;
             return(false);
         }
         else
         {
             cob_word.Visible = true;
             return(true);
         }
     }
     catch
     {
         return(true);
     }
 }
예제 #12
0
        /// <summary>
        /// 读取InI文件
        /// </summary>
        public string ReadInIFile(string node, string nodeType)
        {
            string nodeValue = "";

            try
            {
                nodeValue = db.IniReadValuePivas(node, nodeType);
            }
            catch (Exception)
            {
                throw;
            }
            return(nodeValue);
        }
예제 #13
0
 private bool PrintReport()
 {
     if (report.Pages.Count != 0)
     {
         try
         {
             string        printerName   = DB.IniReadValuePivas("Printer", "LabelPrinter");
             PrintDocument printDocument = new PrintDocument();
             string        Mprint        = printDocument.PrinterSettings.PrinterName;
             if (string.IsNullOrEmpty(printerName))
             {
                 if (printDocument.PrinterSettings.IsValid)
                 {
                     report.PrintSettings.Printer    = Mprint;
                     report.PrintSettings.ShowDialog = false;
                     return(previewControl1.Print());
                 }
                 else
                 {
                     MessageBox.Show("打印机配置为空且系统默认打印机不可用");
                     return(false);
                 }
             }
             else
             {
                 printDocument.PrinterSettings.PrinterName = printerName;
                 if (printDocument.PrinterSettings.IsValid)
                 {
                     report.PrintSettings.Printer    = printerName;
                     report.PrintSettings.ShowDialog = false;
                     return(previewControl1.Print());
                 }
                 else
                 {
                     MessageBox.Show("当前配置的打印机不可用,若使用系统默认打印机,请将打印机配置为空");
                     return(false);
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
예제 #14
0
파일: ToHIS.cs 프로젝트: ewin66/wholePivas
 private void ToHIS_Load(object sender, EventArgs e)
 {
     try
     {
         Thread th = new Thread(() =>
         {
             #region csw修改,需要此exe下配置文件IMEQPIVAs.ini
             ICharge charge = ChargeFactory.GetCharge(dbHelp.IniReadValuePivas("Charge", "HospitalType"));
             #endregion
             ok = charge.PrintCharge(p, userID);
         });
         th.IsBackground = true;
         th.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #15
0
        /// <summary>
        /// 画面初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DBSet_Load(object sender, EventArgs e)
        {
            switch (DBType)
            {
            case DatabaseType.PivasDB:
                tbDataSource.Text = db.IniReadValuePivas("Database", "Data Source");
                tbDBName.Text     = db.IniReadValuePivas("Database", "Initial Catalog");
                tbUserID.Text     = db.Decrypt(db.IniReadValuePivas("Database", "User ID"));
                tbPassword.Text   = db.Decrypt(db.IniReadValuePivas("Database", "Password"));
                break;

            case DatabaseType.HISDB:
                btnTestConnect.Visible = false;  //HIS数据库暂不支持测试
                btnSaveConfig.Enabled  = true;   //保存按钮可用
                tbDataSource.Text      = db.IniReadValueHIS("Database", "Data Source");
                tbDBName.Text          = db.IniReadValueHIS("Database", "Initial Catalog");
                tbUserID.Text          = db.Decrypt(db.IniReadValueHIS("Database", "User ID"));
                tbPassword.Text        = db.Decrypt(db.IniReadValueHIS("Database", "Password"));
                break;

            default:
                break;
            }
        }
예제 #16
0
파일: SetUp.cs 프로젝트: ewin66/wholePivas
        /// <summary>
        /// 浏览设置
        /// </summary>
        private void DataShow()
        {
            DataSet ds = db.GetPIVAsDB(select.IVRecordSetUp(Uid));

            if (ds.Tables[0].Rows.Count > 0)
            {
                //显示模式
                Comb_PreviewMode.SelectedIndex = int.Parse(ds.Tables[0].Rows[0]["PreviewMode"].ToString()) == 3 ? 1 : int.Parse(ds.Tables[0].Rows[0]["PreviewMode"].ToString());
                //显示排序条件
                Comb_LabelOrderBy.SelectedIndex = int.Parse(ds.Tables[0].Rows[0]["LabelOrderBy"].ToString());
                //有数据病区
                if (int.Parse(ds.Tables[0].Rows[0]["WardIdle"].ToString()) == 0)
                {
                    Check_WardIdle.Checked = true;
                }
                else
                {
                    Check_WardIdle.Checked = false;
                }
                //开放病区
                if (int.Parse(ds.Tables[0].Rows[0]["WardOpen"].ToString()) == 0)
                {
                    Check_WardOpen.Checked = true;
                }
                else
                {
                    Check_WardOpen.Checked = false;
                }
                //进入批次时生成瓶签
                if (int.Parse(ds.Tables[0].Rows[0]["AutoGetOrder"].ToString()) == 0)
                {
                    Check_AutoGetOrder.Checked = false;
                }
                else
                {
                    Check_AutoGetOrder.Checked = true;
                }
                //停留在此画面不操作
                if (ds.Tables[0].Rows[0]["TimeCount"] != null && ds.Tables[0].Rows[0]["TimeCount"].ToString().Trim().Length != 0)
                {
                    Com_TimeCount.Text = ds.Tables[0].Rows[0]["TimeCount"].ToString().Trim();
                }
                else
                {
                    Com_TimeCount.SelectedIndex = 0;
                }

                //不计算空包
                if (int.Parse(ds.Tables[0].Rows[0]["IsPack"].ToString()) == 0)
                {
                    Check_Nothing.Checked = true;
                }
                else
                {
                    Check_Nothing.Checked = false;
                }
                //时间点,在这个时间点后显示第二天数据
                if (ds.Tables[0].Rows[0]["NextDay"] != null && ds.Tables[0].Rows[0]["NextDay"].ToString().Trim().Length != 0)
                {
                    string[] time = ds.Tables[0].Rows[0]["NextDay"].ToString().Split(',');
                    Cob_Hour.Text  = time[0];
                    Cob_Month.Text = time[1];
                }
                else
                {
                    Cob_Hour.SelectedText  = "18";
                    Cob_Month.SelectedText = "00";
                }
                if (ds.Tables[0].Columns.Contains("Refresh"))
                {
                    if (ds.Tables[0].Rows[0]["Refresh"].ToString() == "1")
                    {
                        check_refresh.Checked = true;
                    }
                }
                else
                {
                    MessageBox.Show("请在数据库里增加Refresh字段");
                }
            }
            else
            {
                db.SetPIVAsDB(inert.OrderFormSet(Uid));
                Comb_PreviewMode.SelectedItem = 0;
                Check_WardIdle.Checked        = true;
                Check_WardOpen.Checked        = true;
            }
            string dossage = db.IniReadValuePivas("PivasBatch", "AllDrugDossage");

            if (string.IsNullOrEmpty(dossage) || dossage == "0")
            {
                checkBox1.Checked = false;
            }
            else
            {
                checkBox1.Checked = true;
            }

            ds.Dispose();
        }
예제 #17
0
        ////插入LongOrder表
        //private void button_SC_Click(object sender, EventArgs e)
        //{
        //    SetTimeNO();
        //    string InsertSql = " insert into LongOrder(WardCode,OrderDate,DCode) values ('" + Txt_ward.Tag + "', GETDATE(),'" + EmployeeID + "')";
        //    int a = db.SetPIVAsDB(InsertSql);
        //    IsEnble();
        //}

        private void NurseWorkStation_Load(object sender, EventArgs e)
        {
            try
            {
                if (!JugeRight())
                {
                    Application.Exit();
                }
                //label7_Click(null, null);
                IsEnble();
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }


            try
            {
                IniRemTime = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "RemindTime")) * 60;
                keeptime   = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "KeepTime"));
                remindtime = IniRemTime;
            }
            catch (Exception ex)
            {
                IniRemTime = 180;
                remindtime = IniRemTime;
                keeptime   = 5;

                dbHelp.IniWriteValuePivas("Remind", "RemindTime", "3");
                dbHelp.IniWriteValuePivas("Remind", "KeepTime", "5");
            }
            if (dbHelp.GetPivasAllSet("护士站_气泡消息框") == "0")
            {
                QiPao = false;
            }
            else
            {
                QiPao = true;
            }
            if (dbHelp.GetPivasAllSetValue2("护士站-按钮一") == "1")
            {
                btn1.Visible = true;
                btn1.Text    = dbHelp.GetPivasAllSet("护士站-按钮一");
                Match m = Regex.Match(dbHelp.GetPivasAllSetValue3("护士站-按钮一"), "^([0-9]{0,3},){2}[0-9]{0,3}$");
                if (m.Success)
                {
                    string[] a = dbHelp.GetPivasAllSetValue3("护士站-按钮一").Split(',');
                    btn1.ForeColor = Color.FromArgb(Convert.ToInt32(a[0]), Convert.ToInt32(a[1]), Convert.ToInt32(a[2]));
                }
            }
            if (dbHelp.GetPivasAllSetValue2("护士站-按钮二") == "1")
            {
                btn2.Visible = true;
                btn2.Text    = dbHelp.GetPivasAllSet("护士站-按钮二");
                Match m = Regex.Match(dbHelp.GetPivasAllSetValue3("护士站-按钮二"), "^([0-9]{0,3},){2}[0-9]{0,3}$");
                if (m.Success)
                {
                    string[] a = dbHelp.GetPivasAllSetValue3("护士站-按钮二").Split(',');
                    btn2.ForeColor = Color.FromArgb(Convert.ToInt32(a[0]), Convert.ToInt32(a[1]), Convert.ToInt32(a[2]));
                }
            }
            if (dbHelp.GetPivasAllSetValue2("护士站-按钮三") == "1")
            {
                btn3.Visible = true;
                btn3.Text    = dbHelp.GetPivasAllSet("护士站-按钮三");
                Match m = Regex.Match(dbHelp.GetPivasAllSetValue3("护士站-按钮三"), "^([0-9]{0,3},){2}[0-9]{0,3}$");
                if (m.Success)
                {
                    string[] a = dbHelp.GetPivasAllSetValue3("护士站-按钮三").Split(',');
                    btn3.ForeColor = Color.FromArgb(Convert.ToInt32(a[0]), Convert.ToInt32(a[1]), Convert.ToInt32(a[2]));
                }
            }
            if (dbHelp.GetPivasAllSet("护士站-标题显示-1") == "0")
            {
                label3.Visible = false;
            }
            else
            {
                label3.Visible = true;
            }
            if (dbHelp.GetPivasAllSetValue2("护士站-标题显示-1") == "0")
            {
                label5.Visible = false;
            }
            else
            {
                label5.Visible = true;
            }
            if (dbHelp.GetPivasAllSetValue3("护士站-标题显示-1") == "0")
            {
                label6.Visible = false;
            }
            else
            {
                label6.Visible = true;
            }
            if (dbHelp.GetPivasAllSet("护士站-标题显示-2") == "0")
            {
                label7.Visible = false;
            }
            else
            {
                label7.Visible = true;
            }
            if (dbHelp.GetPivasAllSetValue2("护士站-标题显示-2") == "0")
            {
                label8.Visible = false;
            }
            else
            {
                label8.Visible = true;
            }
            if (dbHelp.GetPivasAllSetValue3("护士站-标题显示-2") == "0")
            {
                label4.Visible = false;
            }
            else
            {
                label4.Visible = true;
            }


            //是否闪烁
            ShanShuo();
        }
예제 #18
0
        /// <summary>
        ///  去掉多余的空格。 剂量和单位合并
        /// </summary>
        /// <param name="tags"></param>
        /// <param name="Patcode">病人ID</param>
        public void ShowDD(int tags, string Patcode)
        {
            //查询瓶签明细中的信息
            DataSet ds = DB.GetPIVAsDB(select.IVRecordDetail(Wardcode, pvb.datetime.ToString("yyyyMMdd"), tags, Patcode));
            //右下角规则:先根据病人取出患者的药品信息,医嘱,瓶签信息组成第一张表,取出组号,批次和批次号组成第二张表。
            //然后,按表一循环取出医嘱号,根据医嘱号取出表2的批次号,将所有批次号合并(批次合并规则:如果该医嘱生成了多了批次的瓶签,则将多个批次合并,放入表一的Batch字段,并取出当前瓶签批次的#,K,L,放入表一的Batchs字段。)
            //如果医嘱号与上一行相同,则直接将表一该行的Batch,Batchs设为与上一行相同,unit设为空。
            //最后,如果表一的该药品是溶媒则显示剂量。
            //循环完成之后,将表一的BatchS字段里的含有#,K,L的行分别取出放入三张表里按照医嘱号,批次号进行排序,然后将三张表拼接。
            string Group = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //剂量单位
                string D = ds.Tables[0].Rows[i]["Unit"].ToString().Trim();
                //批次
                string batch = "";

                //如果本行的组号跟Group变量中的组号不一致或者是第一次进入。则合并批次,剂量和单位
                if (ds.Tables[0].Rows[i]["GroupNo"].ToString().Trim().CompareTo(Group) != 0 || i == 0)
                {
                    //组号
                    Group = ds.Tables[0].Rows[i]["GroupNo"].ToString().Trim();

                    //根据组号查询出批次信息
                    DataRow[] dr = ds.Tables[1].Select(" GroupNo='" + Group + "'");

                    //把组号查出的数据的批次合并(如1#,2#)
                    for (int j = 0; j < dr.Length; j++)
                    {
                        if (batch == "")
                        {
                            batch = dr[j][1].ToString();
                        }
                        else
                        {
                            batch = batch + "," + dr[j][1].ToString();
                        }
                    }
                    //把本药品的批次放在Batch中
                    ds.Tables[0].Rows[i]["Batch"] = dr[0][2].ToString();
                    //把本药品的用量和单位合并成剂量

                    ds.Tables[0].Rows[i]["Unit"] = ds.Tables[0].Rows[i]["Dosage"].ToString().Trim() + D;


                    //把合并好的批次放在批次中。(页面显示)
                    ds.Tables[0].Rows[i]["Batch1"] = batch;
                    //如果batch中的批次有多个的情况下
                    if (batch.IndexOf(",") >= 0)
                    {
                        //删除掉多余的批次,只留当前药品的批次
                        string BatchS = batch.Remove(batch.IndexOf(","));
                        //删除BatchS中的批次,只留(#,K,L)
                        if (batch.IndexOf("L") >= 0)
                        {
                            ds.Tables[0].Rows[i]["BatchS"] = "L";
                            //ds.Tables[0].Rows[i]["BatchS"] = batch.Replace(ds.Tables[0].Rows[i]["Batch"].ToString(), "").Replace("-", "");
                        }
                        else
                        {
                            ds.Tables[0].Rows[i]["BatchS"] = BatchS.Replace(ds.Tables[0].Rows[i]["Batch"].ToString(), "").Replace("-", "");
                        }
                    }
                    else
                    {
                        //删除Batch中的批次,只留(#,K,L)
                        if (batch.IndexOf("L") >= 0)
                        {
                            ds.Tables[0].Rows[i]["BatchS"] = "L";
                            //ds.Tables[0].Rows[i]["BatchS"] = batch.Replace(ds.Tables[0].Rows[i]["Batch"].ToString(), "").Replace("-", "");
                        }
                        else
                        {
                            ds.Tables[0].Rows[i]["BatchS"] = batch.Replace(ds.Tables[0].Rows[i]["Batch"].ToString(), "").Replace("-", "");
                        }
                    }
                }
                else //否则
                {
                    ds.Tables[0].Rows[i]["Unit"]   = "";
                    ds.Tables[0].Rows[i]["Batch1"] = "";
                    //获取上个药品的批次和批次单位
                    ds.Tables[0].Rows[i]["Batch"]  = ds.Tables[0].Rows[i - 1]["Batch"].ToString();
                    ds.Tables[0].Rows[i]["BatchS"] = ds.Tables[0].Rows[i - 1]["BatchS"].ToString();
                }
                //string strImagePath = Application.StartupPath+"\\";
                //如果这个药品是溶媒的话。就显示剂量
                string dossage = DB.IniReadValuePivas("PivasBatch", "AllDrugDossage");
                if (string.IsNullOrEmpty(dossage) || dossage == "0")
                {
                    if (ds.Tables[0].Rows[i]["IsMenstruum"].ToString() == "True")
                    {
                        ds.Tables[0].Rows[i]["Unit"] = ds.Tables[0].Rows[i]["Dosage"].ToString().Trim() + D;
                    }
                    else
                    {
                        ds.Tables[0].Rows[i]["Unit"] = "";
                    }
                }
                else
                {
                    ds.Tables[0].Rows[i]["Unit"] = ds.Tables[0].Rows[i]["Dosage"].ToString().Trim() + D;
                }
                ds.Tables[0].Rows[i]["DrugName1"] = ds.Tables[0].Rows[i]["DrugName1"].ToString().Trim();
            }



            df.ClearSelection();

            if (ds.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("瓶签明细查不到相关数据");
                return;
            }

            //#批次的数据
            DataTable dd = ds.Tables[0];
            //dd.Clear();
            //K批次的数据
            DataTable ddd = ds.Tables[0];
            //ddd.Clear();
            //L批次的数据
            DataTable dddd = ds.Tables[0];

            //dddd.Clear();
            dd = DataRowToDatatable(dd.Select("BatchS='#'"), dd);
            DataView dw = dd.DefaultView;

            dw.Sort = "batch ASC,GroupNo ASC";
            dd      = dw.Table;
            ddd     = DataRowToDatatable(ddd.Select("BatchS='K'"), ddd);
            dw      = ddd.DefaultView;
            dw.Sort = "batch ASC,GroupNo ASC";
            ddd     = dw.Table;

            dddd    = DataRowToDatatable(dddd.Select("BatchS='L'"), dddd);
            dw      = dddd.DefaultView;
            dw.Sort = "batch ASC,GroupNo ASC";
            dddd    = dw.Table;

            //把三个Table合成一个Table
            DataTable All = new DataTable();

            All = dd;
            if (ddd.Rows.Count > 0)
            {
                All.Merge(ddd);
            }
            if (dddd.Rows.Count > 0)
            {
                All.Merge(dddd);
            }

            Dgv_Info.DataSource = All;


            //Groupno = Dgv_Info.Rows[0].Cells["GroupNo"].Value.ToString().Trim();
            //Dgv_Info.Columns["状态"].Width = 60;
            //Dgv_Info.Columns["药品"].Width = 210;
            //Dgv_Info.Columns["频次"].Width = 80;
            ////Dgv_Info.Columns[3].Visible = false;
            ////Dgv_Info.Columns["剂量"].Width = 60;
            //Dgv_Info.Columns["剂量"].Visible = false;
            //Dgv_Info.Columns["批次"].Width = 100;
            //Dgv_Info.Columns[7].Visible = false;
            //Dgv_Info.Columns[8].Visible = false;
            //Dgv_Info.Columns[9].Visible = false;
            //Dgv_Info.Columns[10].Visible = false;
            //Dgv_Info.Columns[11].Visible = false;
            //Dgv_Info.Columns["BatchS"].Visible = false;
            //Dgv_Info.Columns[12].Width = 60;
            //Dgv_Info.Columns[13].Visible = false;
            //Dgv_Info.Columns[14].Visible = false;
            //Dgv_Info.Columns[15].Visible = false;
            //赋颜色
            ColorS();

            //如果点击进来有组号的话,根据组号显示信息,
            //否则根据查询出的数据的第一条的组号显示信息
            if (Groupno.Trim().Length > 0)
            {
                if (ds.Tables[0].Select(" GroupNo='" + Groupno + "'").Length > 0)
                {
                    SetInformation(Groupno);
                }
                else
                {
                    SetInformation(ds.Tables[0].Rows[0]["GroupNo"].ToString());
                }
            }
            else
            {
                SetInformation(ds.Tables[0].Rows[0]["GroupNo"].ToString());
            }
        }
예제 #19
0
 private void button1_Click(object sender, EventArgs e)
 {
     db.IniWriteValuePivas("Printer", "EmpReportWe", comboBox2.SelectedIndex.ToString());
     if (report.Pages.Count != 0)
     {
         string printerName = db.IniReadValuePivas("Printer", "LabelPrinter");
         using (PrintDocument printDocument = new PrintDocument())
         {
             string Mprint = printDocument.PrinterSettings.PrinterName;
             if (string.IsNullOrEmpty(printerName))
             {
                 if (printDocument.PrinterSettings.IsValid)
                 {
                     report.PrintSettings.Printer    = Mprint;
                     report.PrintSettings.ShowDialog = false;
                     if (previewControlFR.Print())
                     {
                         db.SetPIVAsDB(string.Format("UPDATE [dbo].[QRcodeLog]SET [DelDT] = GETDATE() WHERE [DelDT] is null and [DEmployeeID]='{0}'", DEmployeeID));
                         db.SetPIVAsDB(string.Format("INSERT INTO [dbo].[QRcodeLog]([DEmployeeID],[QRcode],[QRcodeDT])VALUES('{0}','{1}',GETDATE())", DEmployeeID, value));
                         if (comboBox1.Text != "1")
                         {
                             int g = Convert.ToInt32(comboBox1.Text);
                             for (int i = 1; i < g; i++)
                             {
                                 previewControlFR.Print();
                             }
                         }
                         MessageBox.Show("打印成功");
                     }
                     else
                     {
                         MessageBox.Show("打印失败");
                     }
                 }
                 else
                 {
                     MessageBox.Show("打印机配置为空且系统默认打印机不可用");
                 }
             }
             else
             {
                 printDocument.PrinterSettings.PrinterName = printerName;
                 if (printDocument.PrinterSettings.IsValid)
                 {
                     report.PrintSettings.Printer    = printerName;
                     report.PrintSettings.ShowDialog = false;
                     if (previewControlFR.Print())
                     {
                         db.SetPIVAsDB(string.Format("UPDATE [dbo].[QRcodeLog]SET [DelDT] = GETDATE() WHERE [DelDT] is null and [DEmployeeID]='{0}'", DEmployeeID));
                         db.SetPIVAsDB(string.Format("INSERT INTO [dbo].[QRcodeLog]([DEmployeeID],[QRcode],[QRcodeDT])VALUES('{0}','{1}',GETDATE())", DEmployeeID, value));
                         if (comboBox1.Text != "1")
                         {
                             int g = Convert.ToInt32(comboBox1.Text);
                             for (int i = 1; i < g; i++)
                             {
                                 previewControlFR.Print();
                             }
                         }
                         MessageBox.Show("打印成功");
                     }
                     else
                     {
                         MessageBox.Show("打印失败");
                     }
                 }
                 else
                 {
                     MessageBox.Show("当前配置的打印机不可用,若使用系统默认打印机,请将打印机配置为空");
                 }
             }
         }
     }
 }
예제 #20
0
        public void LoadINI()
        {
            string Moxa = DB.IniReadValuePivas("SCREEN", "type");

            switch (Moxa)
            {
            case "0":
                cbxScreenType.SelectedIndex = 0;
                break;

            case "1":
                cbxScreenType.SelectedIndex = 1;
                break;

            case "2":
                cbxScreenType.SelectedIndex = 2;
                break;

            default:
                MessageBox.Show("屏版本未设置,默认使用旧版");
                cbxScreenType.SelectedIndex = 0;
                DB.IniWriteValuePivas("SCREEN", "type", "0");
                break;
            }

            string RedValue = DB.IniReadValuePivas("doublelight", "openred");

            if (RedValue == "1")
            {
                checkBoxUseRed.Checked = true;
            }
            else if (RedValue == "0")
            {
                checkBoxUseRed.Checked = false;
            }
            else
            {
                MessageBox.Show("初始红灯未设置,默认使用");
                DB.IniWriteValuePivas("doublelight", "openred", "1");
                checkBoxUseRed.Checked = true;
            }

            string GreenValue = DB.IniReadValuePivas("doublelight", "opengreen");

            if (GreenValue == "1")
            {
                checkBoxUseGreen.Checked = true;
            }
            else if (GreenValue == "0")
            {
                checkBoxUseGreen.Checked = false;
            }
            else
            {
                MessageBox.Show("初始绿灯未设置,默认使用");
                DB.IniWriteValuePivas("doublelight", "opengreen", "1");
                checkBoxUseGreen.Checked = true;
            }

            if (cbxMoxaGroup.Text != "")
            {
                string MoxaGroup = DB.IniReadValuePivas("MOXA", "Group");
                if (string.IsNullOrEmpty(MoxaGroup))
                {
                    MessageBox.Show("Moxa组号,默认使用1");
                    DB.IniWriteValuePivas("MOXA", "Group", "1");
                }
                else
                {
                    cbxMoxaGroup.Text = MoxaGroup;
                }
            }
        }
예제 #21
0
        private void LoginUser_Load(object sender, EventArgs e)
        {
            string i = dbHelp.IniReadValuePivas("LastKind", "LastKind");

            comboBox1.Text = i;
        }