Beispiel #1
0
        /// <summary>
        /// 写入台帐
        /// </summary>
        /// <param name="billMaster">单据头表信息</param>
        /// <param name="orderList">单据明细信息</param>
        /// <param name="storeTable">库存处理后的最新药品库存信息</param>
        public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, System.Collections.Hashtable storeTable)
        {
            try
            {
                int                   actYear = 0, actMonth = 0;
                YP_InMaster           master     = (YP_InMaster)billMaster;
                IBaseDAL <YP_Account> accountDao = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, HIS.BLL.Tables.YK_ACCOUNT);

                AccountFactory.GetQuery(ConfigManager.YK_SYSTEM).GetAccountTime(master.AuditTime, ref actYear,
                                                                                ref actMonth, master.DeptID);
                foreach (YP_InOrder order in orderList)
                {
                    string     queryKey  = order.MakerDicID.ToString() + order.BatchNum.ToString();
                    decimal    storeNum  = ((YP_StoreNum)(storeTable[queryKey])).storeNum;
                    int        smallUnit = ((YP_StoreNum)(storeTable[queryKey])).smallUnit;
                    YP_Account account   = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit);
                    ComputeFee(account);
                    accountDao.Add(account);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 药品平账
        /// </summary>
        /// <param name="deptId">药剂科室ID</param>
        public override void BalanceAccount(int deptId)
        {
            try
            {
                //获取对账错误的药品信息
                //触发事件
                _monthEvent.CurrentState = MonthAccountState.SystemChecking;
                AccountHandler(_monthEvent);
                DataTable             wrongAccountDt = SystemCheckAccount(deptId);
                AccountQuery          query          = AccountFactory.GetQuery(ConfigManager.YK_SYSTEM);
                IBaseDAL <YP_Account> accountDao     = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, BLL.Tables.YK_ACCOUNT);

                if (wrongAccountDt.Rows.Count > 0)
                {
                    //触发事件
                    _monthEvent.CurrentState = MonthAccountState.WriteAdjAccount;
                    AccountHandler(_monthEvent);
                    AdjAccount(deptId, wrongAccountDt, query, accountDao);
                }
                //触发事件
                _monthEvent.CurrentState = MonthAccountState.Over;
                AccountHandler(_monthEvent);
            }
            catch (Exception error)
            {
                if (oleDb.IsInTransaction)
                {
                    oleDb.RollbackTransaction();
                }
                throw error;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 写入台帐
        /// </summary>
        /// <param name="billMaster">单据头表信息</param>
        /// <param name="orderList">单据明细信息</param>
        /// <param name="storeTable">库存处理后的最新药品库存信息</param>
        public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, Hashtable storeTable)
        {
            try
            {
                int                   actYear = 0, actMonth = 0;
                decimal               storeNum;
                int                   smallUnit;
                YP_CheckMaster        master     = (YP_CheckMaster)billMaster;
                IBaseDAL <YP_Account> accountDao = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, HIS.BLL.Tables.YF_ACCOUNT);

                AccountFactory.GetQuery(ConfigManager.YF_SYSTEM).GetAccountTime(master.AuditTime, ref actYear,
                                                                                ref actMonth, master.DeptID);
                foreach (YP_CheckOrder order in orderList)
                {
                    if (order.CheckNum != order.FactNum)
                    {
                        storeNum  = ((YP_StoreNum)(storeTable[order.MakerDicID])).storeNum;
                        smallUnit = ((YP_StoreNum)(storeTable[order.MakerDicID])).smallUnit;
                        YP_Account account = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit);
                        ComputeFee(account);
                        accountDao.Add(account);
                    }
                }
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 保存门诊退药单(门诊退药)
        /// </summary>
        /// <param name="billMaster">单据表头</param>
        /// <param name="listOrder">单据明细列表</param>
        /// <param name="deptId">药剂科室ID</param>
        public override void SaveBill(BillMaster billMaster, List <BillOrder> listOrder, long deptId)
        {
            try
            {
                YP_DRMaster refMaster = (YP_DRMaster)billMaster;
                refMaster.RetailFee = 0;
                oleDb.BeginTransaction();
                //将发药单据表头写入数据库
                if (listOrder.Count > 0)
                {
                    //添加退药表头
                    BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Add(refMaster);

                    foreach (YP_DROrder order in listOrder)
                    {
                        order.MasterDrugOCID = refMaster.MasterDrugOCID;
                        BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb, Tables.YF_DRORDER).Add(order);

                        refMaster.RetailFee += order.RetailFee;
                    }
                    refMaster.RetailFee = refMaster.RetailFee * refMaster.RecipeNum;
                    BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Update(refMaster);

                    Hashtable storeTable = StoreFactory.GetProcessor(refMaster.OpType).ChangeStoreNum(billMaster, listOrder);
                    AccountFactory.GetWriter(refMaster.OpType).WriteAccount(billMaster, listOrder, storeTable);
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                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;
            }
        }
        /// <summary>
        /// 保存门诊发药单(门诊发药)
        /// </summary>
        /// <param name="billMaster">门诊发药单表头</param>
        /// <param name="listOrder">门诊发药单明细</param>
        /// <param name="deptId">药剂科室ID</param>
        public override void SaveBill(BillMaster billMaster, List <BillOrder> listOrder, long deptId)
        {
            try
            {
                YP_DRMaster dispMaster = (YP_DRMaster)billMaster;
                dispMaster.RetailFee = 0;
                YP_Storage store = new YP_Storage();
                //将发药单据表头写入数据库
                if (listOrder.Count > 0)
                {
                    //开启发药事务
                    oleDb.BeginTransaction();
                    string strWhere = BLL.Tables.yf_drmaster.RECIPEID + oleDb.EuqalTo() + dispMaster.RecipeID.ToString();
                    if (BindEntity <YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Exists(strWhere))
                    {
                        throw new Exception("该张发票已经发过药品,请刷新病人列表");
                    }
                    BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Add(dispMaster);

                    //更新处方头
                    MZ_BLL.YP_Interface.UpdateSendDrugFlag(dispMaster.RecipeID);
                    //将生成的发药单据表头标识ID赋给所有发药明细
                    foreach (BillOrder baseOrder in listOrder)
                    {
                        YP_DROrder order = (YP_DROrder)baseOrder;
                        order.MasterDrugOCID = dispMaster.MasterDrugOCID;
                        YP_DROrder drOrder = (YP_DROrder)order;
                        BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb, Tables.YF_DRORDER).Add(order);

                        dispMaster.RetailFee += order.RetailFee;
                    }
                    dispMaster.RetailFee = dispMaster.RetailFee * dispMaster.RecipeNum;
                    BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Update(dispMaster);

                    Hashtable storeTable = StoreFactory.GetProcessor(dispMaster.OpType).ChangeStoreNum(billMaster, listOrder);
                    //foreach (YP_StoreNum storeInfo in storeTable.Values)
                    //{
                    //    if (storeInfo.storeNum == -1)
                    //    {
                    //        noStoreList.Add(storeInfo);
                    //    }

                    //}
                    AccountFactory.GetWriter(dispMaster.OpType).WriteAccount(billMaster, listOrder, storeTable);
                    oleDb.CommitTransaction();
                }
            }
            catch (Exception error)
            {
                if (oleDb.IsInTransaction)
                {
                    oleDb.RollbackTransaction();
                }
                throw error;
            }
        }
Beispiel #7
0
        /// <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)
        {
            YP_InMaster inStore = (YP_InMaster)billMaster;

            try
            {
                ////update 20100624
                if (HIS.SYSTEM.Core.BindEntity <object> .CreateInstanceDAL(oleDb, "YP_DEPTDIC").GetFieldValue("DEPTTYPE1", "DEPTID=" + inStore.DeptID).ToString() == "药房")
                {
                    boPjdb = true;
                }
                else
                {
                    boPjdb = false;
                }
                if (billMaster == null)
                {
                    throw new Exception("对应领药单丢失");
                }
                IBaseDAL <YP_InMaster> yfInMaster = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_INMASTER);

                IBaseDAL <YP_InOrder> yfInOrder = BindEntity <YP_InOrder> .CreateInstanceDAL(oleDb, BLL.Tables.YF_INORDER);

                List <YP_InOrder> listOrder     = yfInOrder.GetListArray("MasterInStorageID=" + inStore.MasterInStorageID + "");
                List <BillOrder>  billListOrder = new List <BillOrder>();
                base.AuditPrice(inStore, listOrder, ConfigManager.YF_SYSTEM);
                inStore.AuditTime     = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                inStore.Audit_Flag    = 1;
                inStore.AuditPeopleID = Convert.ToInt32(auditerID);
                yfInMaster.Update(inStore);
                foreach (YP_InOrder orderInstore in listOrder)
                {
                    orderInstore.Audit_Flag = 1;
                    yfInOrder.Update(orderInstore);
                    billListOrder.Add(orderInstore);
                }


                Hashtable storeTable;
                if (((YP_InMaster)billMaster).OpType == ConfigManager.OP_YF_PJDB)
                {
                    ((YP_InMaster)billMaster).OpType = ConfigManager.OP_YF_APPLYIN;
                    storeTable = StoreFactory.GetProcessor(ConfigManager.OP_YF_APPLYIN).ChangeStoreNum(billMaster, billListOrder);
                }
                else
                {
                    storeTable = StoreFactory.GetProcessor(inStore.OpType).ChangeStoreNum(billMaster, billListOrder);
                }
                AccountFactory.GetWriter(inStore.OpType).WriteAccount(billMaster, billListOrder, storeTable);
            }
            catch (Exception error)
            {
                inStore.Audit_Flag = 0;
                throw error;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 住院单人发药
        /// </summary>
        /// <param name="listOrder">发药单明细列表</param>
        /// <param name="dispMaster">发药单表头</param>
        /// <param name="uniformId">统领ID</param>
        private void SingleDisp(List <BillOrder> listOrder, YP_DRMaster dispMaster, int uniformId)
        {
            BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Add(dispMaster);

            //将生成的发药单据表头标识ID赋给所有发药明细
            foreach (BillOrder baseOrder in listOrder)
            {
                YP_DROrder order = (YP_DROrder)baseOrder;
                order.MasterDrugOCID = dispMaster.MasterDrugOCID;
                ZY_BLL.YP_Interface.UpdateSendDrugFlag(order.OrderRecipeID);
                order.UniformID = uniformId;
                BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb, Tables.YF_DRORDER).Add(order);
            }
            Hashtable storeTable = StoreFactory.GetProcessor(dispMaster.OpType).ChangeStoreNum(dispMaster, listOrder);

            AccountFactory.GetWriter(dispMaster.OpType).WriteAccount(dispMaster, listOrder, storeTable);
        }
Beispiel #9
0
        /// <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
            {
                YP_InMaster inStore  = (YP_InMaster)billMaster;
                string      strWhere = BLL.Tables.yk_inmaster.MASTERINSTORAGEID + oleDb.EuqalTo() + inStore.MasterInStorageID
                                       + oleDb.And() + BLL.Tables.yk_inmaster.AUDIT_FLAG + oleDb.EuqalTo() + "1";
                if (BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YK_INMASTER).Exists(strWhere))
                {
                    throw new Exception("该张单据已经审核过。。。");
                }
                oleDb.BeginTransaction();
                DateTime _currentTime = XcDate.ServerDateTime;
                inStore.AuditTime     = _currentTime;
                inStore.Audit_Flag    = 1;
                inStore.AuditPeopleID = Convert.ToInt32(auditerID);
                IBaseDAL <YP_InOrder> ykInOrder = BindEntity <YP_InOrder> .CreateInstanceDAL(oleDb, BLL.Tables.YK_INORDER);

                IBaseDAL <YP_InMaster> ykInMaster = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YK_INMASTER);

                List <YP_InOrder> listStore = ykInOrder.GetListArray("MasterInStorageID=" + inStore.MasterInStorageID + "");
                base.AuditPrice(inStore, listStore, ConfigManager.YK_SYSTEM);
                ykInMaster.Update(inStore);
                List <BillOrder> listOrder = new List <BillOrder>();
                AccountWriter    actWriter = AccountFactory.GetWriter(inStore.OpType);
                foreach (YP_InOrder orderInstore in listStore)
                {
                    orderInstore.Audit_Flag = 1;
                    ykInOrder.Update(orderInstore);
                    listOrder.Add(orderInstore);
                }
                Hashtable storeTable = StoreFactory.GetProcessor(inStore.OpType).ChangeStoreNum(billMaster, listOrder);
                AccountFactory.GetWriter(inStore.OpType).WriteAccount(billMaster, listOrder, storeTable);
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                if (oleDb.IsInTransaction)
                {
                    oleDb.RollbackTransaction();
                }
                throw error;
            }
        }
Beispiel #10
0
        /// <summary>
        /// 住院单人发药
        /// </summary>
        /// <param name="listOrder">发药单明细列表</param>
        /// <param name="dispMaster">发药单表头</param>
        /// <param name="uniformId">统领ID</param>
        private void SingleDisp(List <BillOrder> listOrder, YP_DRMaster dispMaster, int uniformId)
        {
            dispMaster.RetailFee = Decimal.Round(dispMaster.RetailFee + (decimal)0.00000000001, 2);
            BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Add(dispMaster);

            HIS.Interface.IZY_Data zyInterFace = new HIS.Interface.ZY_Data();
            //将生成的发药单据表头标识ID赋给所有发药明细
            for (int index = 0; index < listOrder.Count; index++)
            {
                YP_DROrder order = (YP_DROrder)listOrder[index];
                order.MasterDrugOCID = dispMaster.MasterDrugOCID;
                order.UniformID      = uniformId;
                if (order.DrugOCNum != 0)
                {
                    BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb, Tables.YF_DRORDER).Add(order);
                }
                else
                {
                    listOrder.Remove(order);
                    index--;// add zenghao 20100823
                }
                if (order.DrugOC_Flag == 1)
                {
                    zyInterFace.UpdateSendFlag(order.OrderRecipeID, order.DrugOC_Flag, order.DrugOCNum, order.RetailFee);
                }
                else
                {
                    zyInterFace.UpdateSendFlag(order.OrderRecipeID, 2, -order.DrugOCNum, -order.RetailFee);
                }
            }
            Hashtable storeTable = StoreFactory.GetProcessor(dispMaster.OpType).ChangeStoreNum(dispMaster, listOrder);

            foreach (YP_StoreNum storeInfo in storeTable.Values)
            {
                if (storeInfo.storeNum == -1)
                {
                    noStoreList.Add(storeInfo);
                }
            }
            AccountFactory.GetWriter(dispMaster.OpType).WriteAccount(dispMaster, listOrder, storeTable);
        }
 /// <summary>
 /// 写入台帐
 /// </summary>
 /// <param name="billMaster">单据头表信息</param>
 /// <param name="orderList">单据明细信息</param>
 /// <param name="storeTable">库存处理后的最新药品库存信息</param>
 public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, Hashtable storeTable)
 {
     try
     {
         int         actYear = 0, actMonth = 0;
         int         smallUnit = 0;
         decimal     storeNum  = 0;
         YP_DRMaster master    = (YP_DRMaster)billMaster;
         AccountFactory.GetQuery(ConfigManager.YF_SYSTEM).GetAccountTime(master.OPTime, ref actYear,
                                                                         ref actMonth, master.DeptID);
         foreach (YP_DROrder order in orderList)
         {
             storeNum  = ((YP_StoreNum)(storeTable[order.OrderRecipeID])).storeNum;
             smallUnit = ((YP_StoreNum)(storeTable[order.OrderRecipeID])).smallUnit;
             YP_Account account = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit);
             ComputeFee(account);
         }
     }
     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;
                //审核表头对象
                List <BillOrder> totalListOrder = new List <BillOrder>();
                string           str            = Tables.yf_checkmaster.AUDIT_FLAG + oleDb.EuqalTo() + "0" + oleDb.And() +
                                                  Tables.yf_checkmaster.DEL_FLAG + oleDb.NotEqualTo() + "1" + oleDb.And() +
                                                  Tables.yf_checkmaster.DEPTID + oleDb.EuqalTo() + auditDeptID.ToString();
                List <YP_CheckMaster> listMaster = BindEntity <HIS.Model.YP_CheckMaster> .CreateInstanceDAL(oleDb,
                                                                                                            Tables.YF_CHECKMASTER).GetListArray(str);

                if (listMaster.Count <= 0)
                {
                    ConfigManager.EndCheck((int)auditerID);
                    throw new Exception("没有单据需要审核!");
                }
                DateTime _currentTime = XcDate.ServerDateTime;
                int      groupNum     = (ypDal.YP_Bill_GetBillNum(ConfigManager.OP_YF_AUDITCHECK,
                                                                  auditDeptID)).BillNum;
                foreach (YP_CheckMaster checkMaster in listMaster)
                {
                    if (checkMaster.BillNum == 0)
                    {
                        throw new Exception("当前还有单据在盘点中,请确认所有盘点单据都保存成功");
                    }
                    checkMaster.AuditNum      = groupNum;
                    checkMaster.Audit_Flag    = 1;
                    checkMaster.AuditPeopleID = Convert.ToInt32(auditerID);
                    checkMaster.AuditTime     = _currentTime;
                    checkMaster.DeptID        = Convert.ToInt32(auditDeptID);
                    //读取审核表头对象对应的审核明细链表
                    str = Tables.yf_checkorder.MASTERCHECKID + oleDb.EuqalTo() + checkMaster.MasterCheckID;
                    List <YP_CheckOrder> listOrder = BindEntity <HIS.Model.YP_CheckOrder> .CreateInstanceDAL(oleDb,
                                                                                                             Tables.YF_CHECKORDER).GetListArray(str);

                    //构建盘点汇总明细表
                    AddOrderListByMakerId(totalListOrder, listOrder);
                }
                oleDb.BeginTransaction();
                foreach (YP_CheckMaster checkMaster in listMaster)
                {
                    BindEntity <YP_CheckMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_CHECKMASTER).Update(checkMaster);

                    string nameAndValue = Tables.yf_checkorder.AUDIT_FLAG + oleDb.EuqalTo() + "1";
                    BindEntity <HIS.Model.YP_CheckOrder> .CreateInstanceDAL(oleDb,
                                                                            Tables.YF_CHECKORDER).Update(BLL.Tables.yf_checkorder.MASTERCHECKID + oleDb.EuqalTo() + checkMaster.MasterCheckID,
                                                                                                         nameAndValue);
                }
                YP_CheckMaster newMaster = new YP_CheckMaster();
                newMaster.AuditTime = _currentTime;
                newMaster.DeptID    = Convert.ToInt32(auditDeptID);
                newMaster.BillNum   = groupNum;
                newMaster.OpType    = ConfigManager.OP_YF_AUDITCHECK;
                Hashtable storeTable = StoreFactory.GetProcessor(ConfigManager.OP_YF_CHECK).ChangeStoreNum(newMaster, totalListOrder);
                AccountFactory.GetWriter(ConfigManager.OP_YF_CHECK).WriteAccount(newMaster, totalListOrder, storeTable);
                ConfigManager.EndCheck((int)auditDeptID);
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                if (oleDb.IsInTransaction)
                {
                    oleDb.RollbackTransaction();
                }
                throw error;
            }
        }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="billMaster"></param>
        /// <param name="auditerID"></param>
        /// <param name="auditDeptID"></param>
        public override void AuditBill(BillMaster billMaster, long auditerID, long auditDeptID)
        {
            YP_OutMaster outStore = (YP_OutMaster)billMaster;
            string       strWhere = BLL.Tables.yf_outmaster.MASTEROUTSTORAGEID + oleDb.EuqalTo() + outStore.MasterOutStorageID
                                    + oleDb.And() + BLL.Tables.yf_outmaster.AUDIT_FLAG + oleDb.EuqalTo() + "1";

            if (BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_OUTMASTER).Exists(strWhere))
            {
                throw new Exception("该张单据已经审核过。。。");
            }
            try
            {
                //更改标识位
                oleDb.BeginTransaction();
                DateTime _currentTime             = XcDate.ServerDateTime;
                IBaseDAL <YP_OutMaster> masterDao = BindEntity <YP_OutMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_OUTMASTER);

                IBaseDAL <YP_OutOrder> orderDao = BindEntity <YP_OutOrder> .CreateInstanceDAL(oleDb, BLL.Tables.YF_OUTORDER);

                //审核表头信息
                outStore.Audit_Flag    = 1;
                outStore.AuditTime     = _currentTime;
                outStore.AuditPeopleID = Convert.ToInt32(auditerID);
                //获取明细对象链表
                List <YP_OutOrder> listStore = orderDao.GetListArray("MasterOutStorageID=" + outStore.MasterOutStorageID + "");
                base.AuditPrice(outStore, listStore, ConfigManager.YF_SYSTEM);
                masterDao.Update(outStore);
                List <BillOrder> listOrder = new List <BillOrder>();
                //审核明细
                foreach (YP_OutOrder orderOutstore in listStore)
                {
                    orderOutstore.Audit_Flag = 1;
                    orderDao.Update(orderOutstore);
                    listOrder.Add(orderOutstore);
                }
                Hashtable storeTable = StoreFactory.GetProcessor(outStore.OpType).ChangeStoreNum(billMaster, listOrder);
                AccountFactory.GetWriter(outStore.OpType).WriteAccount(billMaster, listOrder, storeTable);
                //如果是药房申领单,则对药房入库申领单进行审核
//add  平级药房调拨 张运辉 [20100531]
                object obj = HIS.SYSTEM.Core.BindEntity <object> .CreateInstanceDAL(oleDb, "yp_deptdic").GetFieldValue("DEPTTYPE1", "DEPTID=" + outStore.OutDeptId);

                if (obj != null && obj.ToString() == "药房")
                //if (outStore.OpType == ConfigManager.OP_YF_APPLYIN)
                {
                    BillMaster             inStore;
                    IBaseDAL <YP_InMaster> yfInMaster = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_INMASTER);

                    inStore = yfInMaster.GetModel("BillNum=" + outStore.RelationNum.ToString()
                                                  + " AND OpType='" + ConfigManager.OP_YF_PJDB + "'"
                                                  + " AND Audit_Flag=0" + " AND DeptID=" + outStore.OutDeptId.ToString());
                    new ApplyInProcessor().AuditBill(inStore, auditerID, auditDeptID);
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                outStore.Audit_Flag = 0;
                if (oleDb.IsInTransaction)
                {
                    oleDb.RollbackTransaction();
                }
                throw error;
            }
        }