Esempio n. 1
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable storeNumHash = new Hashtable();
         //按厂家典ID对每种药品更新库存
         foreach (YP_CheckOrder order in orderList)
         {
             YP_StoreNum storeNum = new YP_StoreNum();
             storeNum.makerDicId = order.MakerDicID;
             storeNum.smallUnit  = order.LeastUnit;
             storeNum.storeNum   = order.CheckNum;
             storeNumHash.Add(order.MakerDicID, storeNum);
             if (order.CheckNum != order.FactNum)
             {
                 UpdateStoreNum(order.MakerDicID, order.DeptID, order.CheckNum);
             }
         }
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 2
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable   storeNumHash = new Hashtable();
         YP_DRMaster refMaster    = (YP_DRMaster)billMaster;
         foreach (BillOrder billOrder in orderList)
         {
             YP_StoreNum storeNum = new YP_StoreNum();
             YP_DROrder  order    = (YP_DROrder)billOrder;
             storeNum.makerDicId = order.MakerDicID;
             storeNum.smallUnit  = order.LeastUnit;
             int     addNum = Convert.ToInt32(order.DrugOCNum * refMaster.RecipeNum);
             decimal rtn    = AddStoreNum(order.MakerDicID, order.DeptID, addNum);
             if (rtn != -1)
             {
                 storeNum.storeNum = rtn;
                 storeNum.queryKey = storeNum.makerDicId.ToString() + order.OrderRecipeID.ToString();
                 storeNumHash.Add(storeNum.queryKey, storeNum);
             }
             else
             {
                 throw new Exception(order.ChemName + "药品从未入过库");
             }
         }
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 3
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable storeNumHash = new Hashtable();
         foreach (BillOrder order in orderList)
         {
             YP_StoreNum storeNum      = new YP_StoreNum();
             YP_OutOrder orderOutstore = (YP_OutOrder)order;
             storeNum.smallUnit  = orderOutstore.LeastUnit;
             storeNum.makerDicId = orderOutstore.MakerDicID;
             decimal reduceNum = orderOutstore.OutNum;
             decimal rtn       = ReduceStoreNum(orderOutstore.MakerDicID, orderOutstore.DeptID, reduceNum);
             if (rtn != -1)
             {
                 storeNum.storeNum = rtn;
                 storeNum.queryKey = storeNum.makerDicId.ToString() + orderOutstore.ProductNum;
             }
             else
             {
                 string drugName = DrugBaseDataBll.GetDurgName(storeNum.makerDicId);
                 throw new Exception("[" + drugName + "]" + "出库数量过多,审核失败");
             }
             storeNumHash.Add(storeNum.queryKey, storeNum);
         }
         BatchProcessor.ReduceBatchNum(orderList);
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 4
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable storeNumHash = new Hashtable();
         foreach (BillOrder order in orderList)
         {
             YP_CheckOrder orderCheck = (YP_CheckOrder)order;
             YP_StoreNum   storeNum   = new YP_StoreNum();
             if (orderCheck.CheckNum != orderCheck.FactNum)
             {
                 storeNum.makerDicId = orderCheck.MakerDicID;
                 storeNum.smallUnit  = orderCheck.LeastUnit;
                 storeNum.storeNum   = Convert.ToInt32(orderCheck.CheckNum);
                 storeNumHash.Add(storeNum.makerDicId, storeNum);
                 UpdateStoreNum(orderCheck.MakerDicID, orderCheck.DeptID, Convert.ToInt32(orderCheck.CheckNum));
             }
         }
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 5
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable storeNumHash = new Hashtable();
         foreach (BillOrder order in orderList)
         {
             YP_StoreNum storeNum      = new YP_StoreNum();
             YP_OutOrder orderOutstore = (YP_OutOrder)order;
             storeNum.smallUnit  = ypDal.Unit_GetSmallUnit(orderOutstore.MakerDicID);
             storeNum.makerDicId = orderOutstore.MakerDicID;
             decimal reduceNum = orderOutstore.OutNum * orderOutstore.UnitNum;
             decimal rtn       = ReduceStoreNum(orderOutstore.MakerDicID, orderOutstore.DeptID, reduceNum);
             if (rtn != -1)
             {
                 storeNum.storeNum = rtn;
             }
             else
             {
                 throw new Exception("出库数量过多,审核失败");
             }
             storeNumHash.Add(storeNum.makerDicId, storeNum);
         }
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
        /// <summary>
        /// 审核调价单
        /// </summary>
        /// <param name="billMaster">调价单头表</param>
        /// <param name="auditerID">审核人员ID</param>
        /// <param name="auditDeptID">审核科室ID</param>
        public override void AuditBill(BillMaster billMaster, long auditerID, long auditDeptID)
        {
            try
            {
                HIS.DAL.YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                string       strWhere;
                YP_AdjMaster masterAdj    = (YP_AdjMaster)billMaster;
                string       belongSystem = (masterAdj.OpType == ConfigManager.OP_YF_ADJPRICE ? ConfigManager.YF_SYSTEM : ConfigManager.YK_SYSTEM);
                if (ConfigManager.IsChecking((long)masterAdj.DeptID))
                {
                    string deptName = BaseData.GetDeptName(masterAdj.DeptID.ToString());
                    throw new Exception("[" + deptName + "]" + "库房药品正在盘点中....");
                }
                masterAdj.Audit_Flag = 1;
                masterAdj.Over_Flag  = 1;
                BindEntity <HIS.Model.YP_AdjMaster> .CreateInstanceDAL(oleDb).Update(masterAdj);

                strWhere = Tables.yp_adjorder.MASTERIADJPRICED + oleDb.EuqalTo() + masterAdj.MasterAdjPriceID;
                List <YP_AdjOrder> orderList = BindEntity <HIS.Model.YP_AdjOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere);

                List <BillOrder> billOrderList = new List <BillOrder>();
                Hashtable        storeTable    = new Hashtable();
                foreach (YP_AdjOrder adjOrder in orderList)
                {
                    YP_StoreNum yp_StoreNum = new YP_StoreNum();
                    decimal     storeNum    = StoreFactory.GetQuery(belongSystem).QueryNum(adjOrder.MakerDicID, adjOrder.DeptID);
                    adjOrder.Audit_Flag    = 1;
                    adjOrder.AdjNum        = storeNum;
                    yp_StoreNum.makerDicId = adjOrder.MakerDicID;
                    if (belongSystem == ConfigManager.YK_SYSTEM)
                    {
                        yp_StoreNum.smallUnit = adjOrder.LeastUnit;
                    }
                    else
                    {
                        yp_StoreNum.smallUnit = ypDal.Unit_GetSmallUnit(adjOrder.MakerDicID);
                    }
                    yp_StoreNum.storeNum = storeNum;
                    storeTable.Add(yp_StoreNum.makerDicId, yp_StoreNum);
                    //计算调赢/亏金额
                    ComputeAdjFee(adjOrder, belongSystem);
                    billOrderList.Add(adjOrder);
                    BindEntity <HIS.Model.YP_AdjOrder> .CreateInstanceDAL(oleDb).Update(adjOrder);
                }
                //记账
                AccountFactory.GetWriter(masterAdj.OpType).WriteAccount(masterAdj, billOrderList, storeTable);
                //更新药典价格
                foreach (YP_AdjOrder adjOrder in orderList)
                {
                    ChangePrice(adjOrder.NewRetailPrice, true, adjOrder.MakerDicID);
                    ChangePrice(adjOrder.NewTradePrice, false, adjOrder.MakerDicID);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Esempio n. 7
0
        public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
        {
            try
            {
                Hashtable   storeNumHash = new Hashtable();
                YP_InMaster inStore      = (YP_InMaster)billMaster;
                foreach (BillOrder order in orderList)
                {
                    YP_StoreNum storeNum     = new YP_StoreNum();
                    YP_InOrder  orderInstore = (YP_InOrder)order;
                    storeNum.makerDicId = orderInstore.MakerDicID;
                    storeNum.smallUnit  = orderInstore.LeastUnit;
                    IBaseDAL <YP_Storage> storeDao = BindEntity <YP_Storage> .CreateInstanceDAL(oleDb, BLL.Tables.YK_STORAGE);

                    //增加库存
                    decimal rtn = base.AddStoreNum(orderInstore.MakerDicID, orderInstore.DeptID, orderInstore.InNum);
                    if (rtn == -1)
                    {
                        YP_Storage drugStore = new YP_Storage();
                        drugStore.CurrentNum  = orderInstore.InNum;
                        drugStore.Del_Flag    = 0;
                        drugStore.DeptID      = inStore.DeptID;
                        drugStore.LeastUnit   = storeNum.smallUnit;
                        drugStore.LowerLimit  = 0;
                        drugStore.LStockPrice = orderInstore.StockPrice;
                        drugStore.MakerDicID  = orderInstore.MakerDicID;
                        drugStore.RegTime     = inStore.RegTime;
                        drugStore.UnitNum     = orderInstore.UnitNum;
                        drugStore.UpperLimit  = 0;
                        storeDao.Add(drugStore);
                        storeNum.storeNum = orderInstore.InNum;
                    }
                    else
                    {
                        storeNum.storeNum = rtn;
                    }
                    storeNum.queryKey = orderInstore.MakerDicID.ToString() + orderInstore.BatchNum.ToString();
                    storeNumHash.Add(storeNum.queryKey, storeNum);
                }
                BatchProcessor.AddBatchNum(orderList, inStore.RegTime);
                return(storeNumHash);
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Esempio n. 8
0
 public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
 {
     try
     {
         Hashtable   storeNumHash = new Hashtable();
         YP_DRMaster dispMaster   = (YP_DRMaster)billMaster;
         foreach (BillOrder baseOrder in orderList)
         {
             YP_StoreNum storeNum = new YP_StoreNum();
             YP_DROrder  order    = (YP_DROrder)baseOrder;
             storeNum.makerDicId = order.MakerDicID;
             storeNum.smallUnit  = order.LeastUnit;
             int reduceNum = 0;
             if (dispMaster.InvoiceNum == 0) //住院不要用数量乘以处方贴数 update by heyan 2010.10.26 修改中草药处方发药时修改
             {
                 reduceNum = Convert.ToInt32(order.DrugOCNum * 1);
             }
             else//门诊要用数量乘以处方贴数 update by heyan 2010.10.26
             {
                 reduceNum = Convert.ToInt32(order.DrugOCNum * dispMaster.RecipeNum);
             }
             decimal rtn = ReduceStoreNum(order.MakerDicID, order.DeptID, reduceNum);
             if (rtn != -1)//增加药品库存判断 2011.5.10 update by heyan
             {
                 storeNum.storeNum = rtn;
                 storeNum.queryKey = order.OrderRecipeID.ToString();
                 storeNumHash.Add(order.OrderRecipeID, storeNum);
             }
             else
             {
                 throw new Exception(order.ChemName + "药品库存量不足 编码:" + order.MakerDicID.ToString());
             }
         }
         return(storeNumHash);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 9
0
        public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
        {
            try
            {
                Hashtable   storeNumHash = new Hashtable();
                YP_InMaster inStore      = (YP_InMaster)billMaster;
                foreach (BillOrder order in orderList)
                {
                    YP_StoreNum storeNum     = new YP_StoreNum();
                    YP_InOrder  orderInstore = (YP_InOrder)order;
                    storeNum.makerDicId = orderInstore.MakerDicID;
                    storeNum.smallUnit  = orderInstore.LeastUnit;
                    IBaseDAL <YP_Storage> storeDao = BindEntity <YP_Storage> .CreateInstanceDAL(oleDb, BLL.Tables.YK_STORAGE);

                    //增加库存
                    decimal rtn = base.ReduceStoreNum(orderInstore.MakerDicID, orderInstore.DeptID, orderInstore.InNum);
                    if (rtn != -1)
                    {
                        storeNum.storeNum = rtn;
                        storeNum.queryKey = storeNum.makerDicId.ToString() + orderInstore.BatchNum;
                    }
                    else
                    {
                        string drugName = DrugBaseDataBll.GetDurgName(storeNum.makerDicId);
                        throw new Exception("[" + drugName + "]" + "退库数量过多,审核失败");
                    }
                    storeNumHash.Add(storeNum.queryKey, storeNum);
                }
                BatchProcessor.BackBatchNum(orderList);
                return(storeNumHash);
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Esempio n. 10
0
        public override Hashtable ChangeStoreNum(BillMaster billMaster, List <BillOrder> orderList)
        {
            try
            {
                Hashtable   storeNumHash = new Hashtable();
                YP_InMaster inStore      = (YP_InMaster)billMaster;
                YP_Dal      ypDal        = new YP_Dal();
                ypDal._oleDb = oleDb;
                foreach (YP_InOrder orderInstore in orderList)
                {
                    decimal     addNum   = 0;
                    YP_StoreNum storeNum = new YP_StoreNum();
                    storeNum.makerDicId = orderInstore.MakerDicID;
                    IBaseDAL <YP_Storage> storeDao = BindEntity <YP_Storage> .CreateInstanceDAL(oleDb, BLL.Tables.YF_STORAGE);

                    if (inStore.OpType == ConfigManager.OP_YF_INSTORE)
                    {
                        addNum             = orderInstore.InNum;
                        storeNum.smallUnit = orderInstore.LeastUnit;
                    }
                    else
                    {
                        addNum             = orderInstore.InNum * orderInstore.UnitNum;
                        storeNum.smallUnit = ypDal.Unit_GetSmallUnit(storeNum.makerDicId);
                    }
                    //增加库存
                    decimal rtn = base.AddStoreNum(orderInstore.MakerDicID, orderInstore.DeptID, addNum);
                    if (rtn == -1)
                    {
                        if (addNum <= 0)
                        {
                            string drugName = "[" + DrugBaseDataBll.GetDurgName(orderInstore.MakerDicID) + "]";
                            throw new Exception(drugName + "药品库存数量为0,无法录入负数");
                        }
                        YP_Storage drugStore = new YP_Storage();
                        drugStore.CurrentNum  = addNum;
                        drugStore.Del_Flag    = 0;
                        drugStore.DeptID      = inStore.DeptID;
                        drugStore.LeastUnit   = storeNum.smallUnit;
                        drugStore.LowerLimit  = 0;
                        drugStore.LStockPrice = orderInstore.StockPrice;
                        drugStore.MakerDicID  = orderInstore.MakerDicID;
                        drugStore.RegTime     = inStore.RegTime;
                        drugStore.UnitNum     = orderInstore.UnitNum;
                        drugStore.UpperLimit  = 0;
                        storeDao.Add(drugStore);
                        storeNum.storeNum = addNum;
                    }
                    else
                    {
                        storeNum.storeNum = rtn;
                    }
                    storeNum.queryKey = orderInstore.MakerDicID.ToString() + orderInstore.BatchNum.ToString();
                    storeNumHash.Add(storeNum.queryKey, storeNum);
                }
                return(storeNumHash);
            }
            catch (Exception error)
            {
                throw error;
            }
        }