Ejemplo n.º 1
0
        private void InsertIntoStoreRoomMedicineNum(CommContracts.StoreRoomMedicineNum storeRoomMedicineNum)
        {
            if (storeRoomMedicineNum == null)
            {
                return;
            }
            if (CheckStoreRoomMedicineNumRepeat(storeRoomMedicineNum.ID))
            {
                MessageBox.Show(storeRoomMedicineNum.Medicine.Name + "已经存在!");
                return;
            }

            MyDetail item = new MyDetail();

            item.StoreRoomNumID = storeRoomMedicineNum.ID;
            item.Name           = storeRoomMedicineNum.Medicine.Name;
            item.SingleDoseUnit = storeRoomMedicineNum.Medicine.Unit;
            item.Specifications = storeRoomMedicineNum.Medicine.Specifications;
            item.Supplier       = storeRoomMedicineNum.Supplier.Name;
            item.Manufacturer   = storeRoomMedicineNum.Medicine.Manufacturer;
            item.SellPrice      = storeRoomMedicineNum.Medicine.SellPrice;
            item.StockPrice     = storeRoomMedicineNum.StorePrice;
            item.BatchID        = storeRoomMedicineNum.Batch;
            item.ExpirationDate = storeRoomMedicineNum.ExpirationDate;
            item.BeforeOutNum   = storeRoomMedicineNum.Num;


            m_contentItems.Add(item);
            // 跳转到单次剂量
            if (m_skipList.Count > 0)
            {
                GridSkipTo(m_contentItems.Count - 1, m_skipList.ElementAt(0));
            }
        }
Ejemplo n.º 2
0
        public List <CommContracts.StoreRoomMedicineNum> getAllMedicineItemNum(int StoreID,
                                                                               string ItemName,
                                                                               int SupplierID,
                                                                               int ItemType,
                                                                               bool IsStatusOk,
                                                                               bool IsHasNum,
                                                                               bool IsOverDate,
                                                                               bool IsNoEnough)
        {
            List <CommContracts.StoreRoomMedicineNum> list = new List <CommContracts.StoreRoomMedicineNum>();

            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var query = from x in ctx.StoreRoomMedicineNums
                            where x.StoreRoomID == StoreID &&
                            (x.Medicine.Name.StartsWith(ItemName) ||
                             x.Medicine.Abbr1.StartsWith(ItemName) ||
                             x.Medicine.Abbr2.StartsWith(ItemName) ||
                             x.Medicine.Abbr3.StartsWith(ItemName)
                            ) &&
                            (SupplierID == 0 || x.SupplierID == SupplierID) &&
                            (ItemType == -1 || x.Medicine.MedicineTypeEnum == (DAL.MedicineTypeEnum)ItemType) &&
                            (IsHasNum || x.Num <= 0) &&
                            (!IsHasNum || x.Num > 0) &&
                            (!IsOverDate || x.ExpirationDate < DateTime.Now) &&
                            (!IsNoEnough || x.Num < x.Medicine.MinNum)
                            orderby x.Medicine.Name
                            select x;


                foreach (DAL.StoreRoomMedicineNum ass in query)
                {
                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <DAL.StoreRoomMedicineNum, CommContracts.StoreRoomMedicineNum>();
                    });
                    var mapper = config.CreateMapper();

                    CommContracts.StoreRoomMedicineNum temp = mapper.Map <CommContracts.StoreRoomMedicineNum>(ass);
                    list.Add(temp);
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
        // 得到当前药品的合理库存
        public List <CommContracts.StoreRoomMedicineNum> GetStoreFromMedicine(int nMedicineID, int nNum)
        {
            List <CommContracts.StoreRoomMedicineNum> list = new List <CommContracts.StoreRoomMedicineNum>();

            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var query = from x in ctx.StoreRoomMedicineNums
                            where
                            x.MedicineID == nMedicineID &&
                            x.ExpirationDate > DateTime.Now &&
                            //x.StoreRoom.StoreRoomEnum == DAL.StoreRoomEnum.三级库 &&
                            x.Num > 0
                            orderby x.ExpirationDate, x.Num
                select x;

                int nSum = nNum;

                foreach (DAL.StoreRoomMedicineNum ass in query)
                {
                    if (nSum <= 0)
                    {
                        break;
                    }

                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <DAL.StoreRoomMedicineNum, CommContracts.StoreRoomMedicineNum>();
                    });
                    var mapper = config.CreateMapper();

                    CommContracts.StoreRoomMedicineNum temp = mapper.Map <CommContracts.StoreRoomMedicineNum>(ass);
                    nSum -= temp.Num;

                    list.Add(temp);
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        private void Grid1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter || e.Key == Key.Return)
            {
                if (editEnum == MyTableEditEnum.xichengyao || editEnum == MyTableEditEnum.zhongyao || editEnum == MyTableEditEnum.medicineInStock)
                {
                    CommContracts.Medicine medicine = this.Grid1.SelectedItem as CommContracts.Medicine;

                    CurrentMedicine = medicine;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.zhiliao)
                {
                    CommContracts.TherapyItem therapyItem = this.Grid1.SelectedItem as CommContracts.TherapyItem;

                    CurrentTherapyItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.jianyan)
                {
                    CommContracts.AssayItem therapyItem = this.Grid1.SelectedItem as CommContracts.AssayItem;

                    CurrentAssayItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.jiancha)
                {
                    CommContracts.InspectItem therapyItem = this.Grid1.SelectedItem as CommContracts.InspectItem;

                    CurrentInspectItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.cailiao || editEnum == MyTableEditEnum.materialInStock)
                {
                    CommContracts.MaterialItem materialItem = this.Grid1.SelectedItem as CommContracts.MaterialItem;

                    CurrentMaterialItem = materialItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.qita)
                {
                    CommContracts.OtherServiceItem otherServiceItem = this.Grid1.SelectedItem as CommContracts.OtherServiceItem;

                    CurrentOtherServiceItem = otherServiceItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.medicineOutStock)
                {
                    CommContracts.StoreRoomMedicineNum storeRoomMedicineNum = this.Grid1.SelectedItem as CommContracts.StoreRoomMedicineNum;

                    CurrentStoreRoomMedicineNum          = storeRoomMedicineNum;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.materialOutStock)
                {
                    CommContracts.StoreRoomMaterialNum storeRoomMaterialNum = this.Grid1.SelectedItem as CommContracts.StoreRoomMaterialNum;

                    CurrentStoreRoomMaterialNum          = storeRoomMaterialNum;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }