Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            _model.AP1   = cmbAP1.Text;
            _model.AP1No = cmbAP1.SelectedValue.ToStringForce();
            _model.AP2   = cmbAP2.Text;
            _model.AP2No = cmbAP2.SelectedValue.ToStringForce();

            _model.AP3   = cmbAp3.Text;
            _model.AP3No = cmbAp3.SelectedValue.ToStringForce();

            _model.SN1   = cmbSN1.Text;
            _model.SN1No = cmbSN1.SelectedValue.ToStringForce();

            _model.SN2   = cmbSN2.Text;
            _model.SN2No = cmbSN2.SelectedValue.ToStringForce();
            _model.ON1   = cmbON1.Text;
            _model.ON1No = cmbON1.SelectedValue.ToStringForce();
            _model.ON2   = cmbON2.Text;
            _model.ON2No = cmbON2.SelectedValue.ToStringForce();
            _model.AP1   = cmbAP1.Text;
            _model.AP1No = cmbAP1.SelectedValue.ToStringForce();
            _model.AP2   = cmbAP2.Text;
            _model.AP2No = cmbAP2.SelectedValue.ToStringForce();

            _model.AP3    = cmbAp3.Text;
            _model.AP3No  = cmbAp3.SelectedValue.ToStringForce();
            _model.SN1    = cmbSN1.Text;
            _model.SN1No  = cmbSN1.SelectedValue.ToStringForce();
            _model.SN2    = cmbSN2.Text;
            _model.SN2No  = cmbSN2.SelectedValue.ToStringForce();
            _model.ON1    = cmbON1.Text;
            _model.ON1No  = cmbON1.SelectedValue.ToStringForce();
            _model.ON2    = cmbON2.Text;
            _model.ON2No  = cmbON2.SelectedValue.ToStringForce();;
            _model.Oroom  = cmbOroom.Text;
            _model.Second = tbSecond.Text;
            if (_model.Ostate < 1)
            {
                _model.Ostate = 1;
            }

            int RES = dal.UpdatePaiban(_model);

            if (RES > 0)
            {
                string message = Hl7Bll.AppendHL7stringConfig(_model.ID, Program.yh, Program.zhanghao);
                LogHelp.SaveLogHL7(message);
                string HL7IPaddress = ConfigurationManager.AppSettings["HL7IPaddress"];
                string HL7port      = ConfigurationManager.AppSettings["HL7port"];
                SenderRoutingLib.SocketSender send = new SenderRoutingLib.SocketSender();
                object objResult;
                int    iResult = 0;
                int    count   = 1;
                if (count < 10)
                {
                    new System.Threading.Thread(o =>
                    {
                        for (int i = 0; i < count; i++)
                        {
                            objResult  = send.Send(message, HL7IPaddress, Convert.ToInt32(HL7port));
                            string ack = objResult == null ? string.Empty : objResult.ToString();
                            if (ack.Contains("AA"))
                            {
                                iResult++;
                                LogHelp.SaveLogHL7(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                _model.IsSend = 1;
                                dal.UpdatePaiban(_model);
                                // SetText(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                            }
                            else
                            {
                                iResult++;
                                LogHelp.SaveLogHL7(string.Format("\r\n消息处理失败原因:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                // SetText(string.Format("\r\n消息处理失败原因:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                            }
                        }
                    }).Start();
                }
                else
                {
                    for (int j = 0; j < 10; j++)
                    {
                        new System.Threading.Thread(o =>
                        {
                            for (int i = 0; i < count / 10; i++)
                            {
                                objResult  = send.Send(message, HL7IPaddress, Convert.ToInt32(HL7port));
                                string ack = objResult == null ? string.Empty : objResult.ToString();
                                if (ack.Contains("AA"))
                                {
                                    iResult++;
                                    // SetText(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                }
                                else
                                {
                                    iResult++;
                                    //SetText(string.Format("\r\n发送失败,错误信息:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                }
                            }
                        }).Start();
                    }
                }


                this.Close();
            }
            else
            {
                MessageBox.Show("保存排班失败,请重试!");
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvOTypesetting.SelectedCells.Count == 1)
                {
                    List <PaibanDto> list    = (List <PaibanDto>)dgvOTypesetting.DataSource;
                    PaibanDto        model   = list[dgvOTypesetting.CurrentRow.Index];
                    string           patid   = model.PatID;
                    string           Oroom   = model.Oroom;
                    string           Osecond = model.Second;
                    //string patid = dgvOTypesetting.CurrentRow.Cells["patid"].Value.ToString();
                    //string Oroom = dgvOTypesetting.CurrentRow.Cells["Oroom"].Value.ToString();
                    //string Osecond = dgvOTypesetting.CurrentRow.Cells["second"].Value.ToString();
                    if (Oroom.IsNullOrEmpty() && Osecond.IsNullOrEmpty())
                    {
                        MessageBox.Show("手术间和台次不能都为空");
                        return;
                    }

                    string message = Hl7Bll.AppendHL7stringConfig(model.ID, "卢赛芳", "486");

                    LogHelp.SaveLogHL7(message);
                    string HL7IPaddress = ConfigurationManager.AppSettings["HL7IPaddress"];
                    //if (message.Length > 0 && UserFunction.PingHost(HL7IPaddress))
                    if (true)
                    {
                        string HL7port = ConfigurationManager.AppSettings["HL7port"];
                        SenderRoutingLib.SocketSender send = new SenderRoutingLib.SocketSender();
                        object objResult;
                        int    iResult = 0;
                        int    count   = 1;
                        if (count < 10)
                        {
                            new System.Threading.Thread(o =>
                            {
                                for (int i = 0; i < count; i++)
                                {
                                    objResult  = send.Send(message, HL7IPaddress, Convert.ToInt32(HL7port));
                                    string ack = objResult == null ? string.Empty : objResult.ToString();
                                    if (ack.Contains("AA"))
                                    {
                                        iResult++;
                                        LogHelp.SaveLogHL7(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                        // SetText(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                    }
                                    else
                                    {
                                        iResult++;
                                        LogHelp.SaveLogHL7(string.Format("\r\n消息处理失败原因:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                        // SetText(string.Format("\r\n消息处理失败原因:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                    }
                                }
                            }).Start();
                        }
                        else
                        {
                            for (int j = 0; j < 10; j++)
                            {
                                new System.Threading.Thread(o =>
                                {
                                    for (int i = 0; i < count / 10; i++)
                                    {
                                        objResult  = send.Send(message, HL7IPaddress, Convert.ToInt32(HL7port));
                                        string ack = objResult == null ? string.Empty : objResult.ToString();
                                        if (ack.Contains("AA"))
                                        {
                                            iResult++;
                                            // SetText(string.Format("\r\n成功条数:{0} \r\n结束时间:{1}", iResult.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                        }
                                        else
                                        {
                                            iResult++;
                                            //SetText(string.Format("\r\n发送失败,错误信息:{0} \r\n结束时间:{1}", ack, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                                        }
                                    }
                                }).Start();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("IP地址或端口错误");
                    }
                }
                else
                {
                    MessageBox.Show("请选择一位病人");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }