コード例 #1
0
        //InsertIntoStoreRoomMaterialNum
        private void InsertIntoStoreRoomMaterialNum(CommContracts.StoreRoomMaterialNum storeRoomMaterialNum)
        {
            if (storeRoomMaterialNum == null)
            {
                return;
            }
            if (CheckStoreRoomMaterialNumRepeat(storeRoomMaterialNum.ID))
            {
                MessageBox.Show(storeRoomMaterialNum.MaterialItem.Name + "已经存在!");
                return;
            }

            MyDetail item = new MyDetail();

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


            m_contentItems.Add(item);
            // 跳转到单次剂量
            if (m_skipList.Count > 0)
            {
                GridSkipTo(m_contentItems.Count - 1, m_skipList.ElementAt(0));
            }
        }
コード例 #2
0
        public List <CommContracts.StoreRoomMaterialNum> getAllMaterialItemNum(int StoreID,
                                                                               string ItemName,
                                                                               int SupplierID,
                                                                               int ItemType,
                                                                               bool IsStatusOk,
                                                                               bool IsHasNum,
                                                                               bool IsOverDate,
                                                                               bool IsNoEnough)
        {
            List <CommContracts.StoreRoomMaterialNum> list = new List <CommContracts.StoreRoomMaterialNum>();

            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var query = from x in ctx.StoreRoomMaterialNums
                            where x.StoreRoomID == StoreID &&
                            (x.MaterialItem.Name.StartsWith(ItemName) ||
                             x.MaterialItem.AbbrPY.StartsWith(ItemName) ||
                             x.MaterialItem.AbbrWB.StartsWith(ItemName)
                            ) &&
                            (SupplierID == 0 || x.SupplierID == SupplierID) &&
                            (IsHasNum || x.Num <= 0) &&
                            (!IsHasNum || x.Num > 0) &&
                            (!IsOverDate || x.ExpirationDate < DateTime.Now) &&
                            (!IsNoEnough || x.Num < x.MaterialItem.MinNum)
                            orderby x.MaterialItem.Name
                            select x;


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

                    CommContracts.StoreRoomMaterialNum temp = mapper.Map <CommContracts.StoreRoomMaterialNum>(ass);
                    list.Add(temp);
                }
            }
            return(list);
        }
コード例 #3
0
        // 得到当前药品的合理库存
        public List <CommContracts.StoreRoomMaterialNum> GetStoreFromMaterial(int nMaterialID, int nNum)
        {
            List <CommContracts.StoreRoomMaterialNum> list = new List <CommContracts.StoreRoomMaterialNum>();

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

                int nSum = nNum;

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

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

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

                    list.Add(temp);
                }
            }
            return(list);
        }
コード例 #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();
                }
            }
        }