Ejemplo n.º 1
0
        /// <summary>
        /// 根据瓶签号,生成所有信息,发送到屏进行显示
        /// </summary>
        /// <param name="labelNo">扫描到的瓶签号</param>
        /// <param name="chargeRtnValue">计费返回值0=计费失败,不可配置;非0=计费成功,可配置</param>
        /// <param name="chargeMsg">计费补充消息</param>
        public void SendInfoToScreen(ScreenClientController screenClientController, string screenIp, int screenPort,
                                     string labelNo, short chargeRtnValue, string chargeMsg, string employeeName, string mixCount)
        {
            //扔进线程池
            smartThreadPool.QueueWorkItem(() =>
            {
                try
                {
                    string mixMethods           = string.Empty;
                    MsgScreenInfo msgScreenInfo = new MsgScreenInfo();

                    DataSet dsLableInfo = dbHelp.GetPIVAsDB(GET_LABELINFO + labelNo);
                    if (dsLableInfo.Tables.Count > 0 && dsLableInfo.Tables[0].Rows.Count > 0)
                    {
                        msgScreenInfo.MsgType       = (short)MsgType.ScrennInfo;
                        msgScreenInfo.ChargeMessage = chargeMsg;
                        msgScreenInfo.ChargeResult  = chargeRtnValue;
                        msgScreenInfo.EmployeeName  = employeeName.Trim();
                        msgScreenInfo.LabelNo       = labelNo;
                        msgScreenInfo.MixCount      = mixCount;
                        msgScreenInfo.PatientName   = dsLableInfo.Tables[0].Rows[0]["PatName"].ToString().Trim();
                        msgScreenInfo.ShowTime      = DateTime.Now.ToString("HH:mm:ss MM/dd");
                        msgScreenInfo.WardName      = dsLableInfo.Tables[0].Rows[0]["WardName"].ToString().Trim();
                        msgScreenInfo.Drugs         = new List <MsgDrugRowInfo>();
                        msgScreenInfo.Methods       = new List <string>();

                        //遍历获取药品行信息
                        for (int i = 0; i < dsLableInfo.Tables[0].Rows.Count; i++)
                        {
                            string uniPreparationID = dsLableInfo.Tables[0].Rows[i]["UniPreparationID"].ToString();
                            InternalLogger.Log.Debug("uniPreparationID:" + uniPreparationID);
                            mixMethods += GetMixMethodByDrugCode(uniPreparationID);

                            MsgDrugRowInfo msgDrugRowInfo = new MsgDrugRowInfo();
                            msgDrugRowInfo.DrugIndex      = listIndex[i];//从A开始
                            msgDrugRowInfo.DrugName       = dsLableInfo.Tables[0].Rows[i]["DrugName"].ToString().Trim();
                            msgDrugRowInfo.DrugSpec       = dsLableInfo.Tables[0].Rows[i]["Spec"].ToString().Trim();
                            msgDrugRowInfo.DrugDose       = dsLableInfo.Tables[0].Rows[i]["Dosage"].ToString().Trim();
                            msgDrugRowInfo.DrugCount      = dsLableInfo.Tables[0].Rows[i]["DgNo"].ToString().Trim();
                            msgScreenInfo.Drugs.Add(msgDrugRowInfo);
                        }

                        //药品配置方法行
                        string[] s = SplitByLen(mixMethods, 50);
                        foreach (var item in s)
                        {
                            msgScreenInfo.Methods.Add(item);
                        }
                    }
                    //发送到屏
                    screenClientController.sendDataEnqueue(new PivasEventArgs <TCPMessage>(new TCPMessage(screenIp, screenPort, msgScreenInfo.ToJson())));
                }
                catch (Exception ex)
                {
                    InternalLogger.Log.Error("根据瓶签号,生成信息并发送到屏进行显示出错:" + ex.Message);
                }
            });
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 发送药师登录状态到屏
 /// </summary>
 public void SendLoginStatus(ScreenClientController screenClientController, string screenIp, int screenPort, short status)
 {
     smartThreadPool.QueueWorkItem(() =>
     {
         try
         {
             MsgLoginResult msgLoginResult = new MsgLoginResult();
             msgLoginResult.MsgType        = (short)MsgType.LoginStatus;
             msgLoginResult.Status         = status;
             //将登陆状态发给屏,微软屏
             screenClientController.sendDataEnqueue(new PivasEventArgs <TCPMessage>(new TCPMessage(screenIp,
                                                                                                   screenPort, msgLoginResult.ToJson())));
         }
         catch (Exception ex)
         {
             InternalLogger.Log.Error("发送药师登录状态到屏出错:" + ex.Message);
         }
     });
 }