Пример #1
0
        /// <summary>
        /// 作废用药申请
        /// </summary>
        /// <returns>成功返回1 失败返回-1</returns>
        internal int CancelApply()
        {
            if (this.fpCancelApply_Sheet1.Rows.Count <= 0)
            {
                return(0);
            }

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            //Neusoft.FrameWork.Management.Transaction t = new Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();

            Neusoft.HISFC.BizLogic.Pharmacy.Item itemManager = new Neusoft.HISFC.BizLogic.Pharmacy.Item();
            //itemManager.SetTrans(t.Trans);
            //{E8849BB0-3C69-4d60-8771-C201E445BD5D}  预扣库存的判断处理
            Neusoft.HISFC.BizProcess.Integrate.Common.ControlParam ctrlIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Common.ControlParam();
            bool isPreOut = ctrlIntegrate.GetControlParam <bool>(Neusoft.HISFC.BizProcess.Integrate.PharmacyConstant.InDrug_Pre_Out, false, true);

            for (int i = 0; i < this.fpCancelApply_Sheet1.Rows.Count; i++)
            {
                string applyID = this.fpCancelApply_Sheet1.Cells[i, (int)ColumnSet.ColID].Text;

                Neusoft.HISFC.Models.Pharmacy.ApplyOut applyOut = this.hsApply[applyID] as Neusoft.HISFC.Models.Pharmacy.ApplyOut;

                //对已经无效的数据 不重复保存
                if (applyOut.ValidState == Neusoft.HISFC.Models.Base.EnumValidState.Invalid)
                {
                    continue;
                }

                //作废摆药申请
                //{E8849BB0-3C69-4d60-8771-C201E445BD5D}  传入参数调整
                if (itemManager.CancelApplyOutByID(applyOut.ID, isPreOut) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("作废摆药申请失败"));
                    return(-1);
                }

                //作废医嘱执行档
            }

            Neusoft.FrameWork.Management.PublicTrans.Commit();

            MessageBox.Show(Language.Msg("作废申请成功"));

            this.Clear();

            return(1);
        }