示例#1
0
        /// <summary>
        /// 根据瓶签号,生成所有信息,发送到屏进行显示
        /// </summary>
        /// <param name="labelNo">扫描到的瓶签号,第三方瓶签是不是还要逆过去</param>
        /// <param name="chargeRtnValue">计费返回值0=计费失败,不可配置;非0=计费成功,可配置</param>
        /// <param name="chargeMsg">计费补充消息</param>
        public void SendInfoToScreen(DisplayController displayController, string screenIp, int screenPort,
                                     string labelNo, string chargeRtnValue, string chargeMsg, string employeeName, string MixCount)
        {
            //清空药品信息行\配置方法行\计费结果
            ClearDrugInfo(displayController, screenIp, screenPort);
            ClearChareRes(displayController, screenIp, screenPort);
            ClearMethodRow(displayController, screenIp, screenPort);

            //扔进线程池
            smartThreadPool.QueueWorkItem(() =>
            {
                try
                {
                    SendEmployeeRow(displayController, screenIp, screenPort, employeeName, MixCount);//发送药师信息

                    string mixMethods = string.Empty;

                    DataSet dsLableInfo = dbHelp.GetPIVAsDB(GET_LABELINFO + labelNo);
                    if (dsLableInfo.Tables.Count > 0 && dsLableInfo.Tables[0].Rows.Count > 0)
                    {
                        SendPatientRow(displayController, screenIp, screenPort, labelNo, dsLableInfo);      //发送患者信息

                        List <MsgDrugRow> lstDrugRow = GetDrugRowAndMixMethod(dsLableInfo, out mixMethods); //获取药品信息和配置方法

                        SendChareRes(displayController, screenIp, screenPort, chargeRtnValue, chargeMsg);   //发送计费结果

                        foreach (MsgDrugRow item in lstDrugRow)
                        {
                            PackSendData(displayController, screenIp, screenPort, item);//循环发送药品信息
                        }

                        #region 发送配置方法
                        if (!string.IsNullOrEmpty(mixMethods))
                        {
                            MsgDrugMixMethod drugMixMethod = new MsgDrugMixMethod();
                            drugMixMethod.RowAddress       = BitConverter.GetBytes(GetScreenAddress(ScreenMsgType.DrugMixMethod));
                            Array.Reverse(drugMixMethod.RowAddress);//大小端转换

                            GeneralMethodRow(ref drugMixMethod, mixMethods);
                            PackSendData(displayController, screenIp, screenPort, drugMixMethod);
                        }
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    InternalLogger.Log.Error("根据瓶签号,生成信息并发送到屏进行显示出错:" + ex.Message);
                }
            });
        }
示例#2
0
        /// <summary>
        /// 清空配置方法行
        /// </summary>
        /// <param name="displayController"></param>
        /// <param name="screenIp"></param>
        /// <param name="screenPort"></param>
        private void ClearMethodRow(DisplayController displayController, string screenIp, int screenPort)
        {
            try
            {
                MsgDrugMixMethod drugMixMethod = new MsgDrugMixMethod();
                drugMixMethod.RowAddress = BitConverter.GetBytes(GetScreenAddress(ScreenMsgType.DrugMixMethod));
                Array.Reverse(drugMixMethod.RowAddress);//大小端转换

                drugMixMethod.MixMethodRow1 = GetStandandArray(drugMixMethod, "MixMethodRow1", string.Empty);
                drugMixMethod.MixMethodRow2 = GetStandandArray(drugMixMethod, "MixMethodRow2", string.Empty);
                drugMixMethod.MixMethodRow3 = GetStandandArray(drugMixMethod, "MixMethodRow3", string.Empty);
                drugMixMethod.MixMethodRow4 = GetStandandArray(drugMixMethod, "MixMethodRow4", string.Empty);

                PackSendData(displayController, screenIp, screenPort, drugMixMethod);
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("清空配置方法行出错:" + ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 生成四行药品配置方法
        /// </summary>
        /// <param name="index"></param>
        private void GeneralMethodRow(ref MsgDrugMixMethod method, string mixMethods)
        {
            try
            {
                string[] arrayDrugMixMethod = SplitByLen(mixMethods, 25); //每行25个汉字

                for (int index = 0; index < 4; index++)                   //固定4行
                {
                    if (index >= arrayDrugMixMethod.Length)
                    {
                        break;//跳出for
                    }
                    switch (index)
                    {
                    case 0:
                        method.MixMethodRow1 = GetStandandArray(method, "MixMethodRow1", arrayDrugMixMethod[index]);
                        break;

                    case 1:
                        method.MixMethodRow2 = GetStandandArray(method, "MixMethodRow2", arrayDrugMixMethod[index]);
                        break;

                    case 2:
                        method.MixMethodRow3 = GetStandandArray(method, "MixMethodRow3", arrayDrugMixMethod[index]);
                        break;

                    case 3:
                        method.MixMethodRow4 = GetStandandArray(method, "MixMethodRow4", arrayDrugMixMethod[index]);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                InternalLogger.Log.Error("生成四行药品配置方法出错:" + ex.Message);
            }
        }