예제 #1
0
        /// <summary>
        /// 弹出物品选择器
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="def"></param>
        /// <param name="atPoint"></param>
        private void ShowMmSelector(XDataRow row, List <EmsOrDrug> ds, EmsOrDrug def, Point atPoint, bool canEdit = true)
        {
            var mmContainer = new XBaseControl();

            mmContainer.Size = new Size(473, 160);

            var query = from items in ds orderby items.Fact_count descending select items;

            var mm = new ExtMmRefView(LogicEx.GetInstance().ConvertDataSouse <EmsOrDrug>(query.ToList()), def, false);

            mm.Dock = DockStyle.Fill;
            mmContainer.AddRender(mm);
            var popWindow = new XContextForm(mmContainer);

            mm.Event_SelectChanged += (sender, e) =>
            {
                EmsOrDrug orDrug = EmsHeadDO.Emsdrugs.EmsOrDrugList[gv.FocusedRowHandle];
                var       mmDrug = e.Data as EmsOrDrug;

                if (mmDrug == null)
                {
                    if (orDrug.Fg_self == true)
                    {
                        orDrug.Name_mm = orDrug.Name_srv;
                        orDrug.Id_mm   = null;
                    }
                    popWindow.Close();
                    return;
                }

                #region 皮试逻辑的判断
                if (mmDrug.Fg_skintest != null && mmDrug.Fg_skintest == true)
                {
                    SkinTestLogic logic = new SkinTestLogic(EmsHeadDO.PatInfo);
                    orDrug.Name_mm    = mmDrug.Name_mm;
                    orDrug.Id_mm      = mmDrug.Id_mm;
                    orDrug.Id_srvskin = mmDrug.Id_srvskin;
                    if (logic.skinTestLogic(orDrug).Equals("0"))
                    {
                        popWindow.Close();
                        return;
                    }
                }
                #endregion
                cof.CopyTo(mmDrug, orDrug, "Id_srv", "Name_srv");
                cof.concateMMSpecAndName(orDrug);
                orDrug.Fg_mm = true;
                updateTableCustomerComtrol();
                popWindow.Close();
            };
            popWindow.Show(atPoint);
            mm.Enabled = canEdit;
        }