Пример #1
0
        /// <summary>
        /// 对用户确认的出库申请数组进行发药处理(打印摆药单)
        /// writed by cuipeng
        /// 2005-1
        /// 操作如下:
        /// 1、如果该记录未计费,则
        ///		确定摆药是否对药品数量取整(只对每次量取整),确定数量。
        ///		取最新的药品基本信息
        ///	2、更新医嘱执行档(摆药确认信息)
        ///	3、更新药嘱主档的最新的执行信息
        ///	4、如果摆药的同时需要出库则处理出库数据,否则,只确认不处理出库数据
        ///	5、更新出库申请表中的摆药信息
        ///	6、如果全部核准,则更新摆药通知信息。否则不更新摆药通知信息
        ///	摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中
        /// </summary>
        /// <param name="arrayApplyOut">出库申请信息</param>
        /// <param name="drugMessage">摆药通知,用来更新摆药通知(摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中)</param>
        /// <returns>1成功,-1失败</returns>
        internal static int DrugConfirm(ArrayList arrayApplyOut, Neusoft.HISFC.Models.Pharmacy.DrugMessage drugMessage, Neusoft.FrameWork.Models.NeuObject arkDept, Neusoft.FrameWork.Models.NeuObject approveDept)
        {
            string noPrivPatient = "";

            if (JudgeInStatePatient(arrayApplyOut, null, ref noPrivPatient) == -1)
            {
                System.Windows.Forms.MessageBox.Show("判断患者状态信息发生错误");
                return(-1);
            }
            if (noPrivPatient != "")
            {
                System.Windows.Forms.MessageBox.Show(noPrivPatient);
                return(-1);
            }
            //对申请项目按照项目编码排序 减少资源死锁的发生几率 {1B35A424-0127-42ff-96A4-6835D5DB0151}
            Neusoft.HISFC.BizProcess.Integrate.PharmacyMethod.SortApplyOutByItemCode(ref arrayApplyOut);

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            if (pharmacyIntegrate.InpatientDrugConfirm(arrayApplyOut, drugMessage, arkDept, approveDept) != 1)
            {
                System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
                return(-1);
            }
            return(1);
        }
Пример #2
0
        /// <summary>
        /// 退费保存
        /// </summary>
        /// <returns>成功返回1 失败返回-1</returns>
        protected int SaveBack()
        {
            ArrayList alCheckData = this.GetCheckData();

            if (alCheckData.Count == 0)
            {
                return(0);
            }

            Neusoft.FrameWork.Management.DataBaseManger dataManager = new DataBaseManger();

            Neusoft.FrameWork.Models.NeuObject approveDept = ((Neusoft.HISFC.Models.Base.Employee)dataManager.Operator).Dept;

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            if (pharmacyIntegrate.CompoundBackFee(alCheckData, approveDept) != 1)
            {
                MessageBox.Show(Language.Msg(pharmacyIntegrate.Err) + " 该标签可能已完成退费!");
                return(-1);
            }

            MessageBox.Show(Language.Msg("保存成功"));

            this.Clear();

            return(1);
        }
Пример #3
0
 /// <summary>
 /// 对已打印的摆药单进行核准处理(摆药核准)
 /// writed by cuipeng
 /// 2005-1
 /// 操作如下:
 /// 1、如果需要在核准时出库,则进行出库处理。并取得applyOut.OutBillCode
 /// 2、如果该记录未收费,则处理费用信息,否则更新费用表中的发药状态和出库流水号
 /// 3、核准摆药单
 /// </summary>
 /// <param name="arrayApplyOut">出库申请信息</param>
 /// <param name="approveOperCode">核准人(摆药人)</param>
 /// <param name="deptCode">核准科室</param>
 /// <returns>1成功,-1失败</returns>
 internal static int DrugApprove(ArrayList arrayApplyOut, string approveOperCode, string deptCode, System.Data.IDbTransaction trans)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
     if (pharmacyIntegrate.InpatientDrugApprove(arrayApplyOut, approveOperCode, deptCode, trans) != 1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #4
0
 /// <summary>
 /// 对退药申请进行核准处理(退药核准)
 /// writed by cuipeng
 /// 2005-3
 /// 操作如下:
 /// 1、出库处理,返回出库流水号。
 /// 2、如果退药的同时退费,则处理费用信息
 /// 3、核准出库申请,将摆药状态由“0”改成ApplyState。
 /// 4、取费用信息
 /// 5、进行退费申请
 /// 6、如果全部核准,则更新摆药通知信息。否则不更新摆药通知信息
 /// 摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中
 /// </summary>
 /// <param name="arrayApplyOut">出库申请信息</param>
 /// <param name="drugMessage">摆药通知,用来更新摆药通知(摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中)</param>
 /// <returns>1成功,-1失败</returns>
 internal static int DrugReturnConfirm(ArrayList arrayApplyOut, Neusoft.HISFC.Models.Pharmacy.DrugMessage drugMessage, Neusoft.FrameWork.Models.NeuObject arkDept, Neusoft.FrameWork.Models.NeuObject approveDept)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy( );
     if (pharmacyIntegrate.InpatientDrugReturnConfirm(arrayApplyOut, drugMessage, arkDept, approveDept) != 1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #5
0
 /// <summary>
 /// 门诊发药保存
 /// </summary>
 /// <param name="applyOutCollection">摆药申请信息</param>
 /// <param name="terminal">发药终端</param>
 /// <param name="sendDept">发药科室信息(扣库科室)</param>
 /// <param name="sendOper">发药人员信息</param>
 /// <param name="isDirectSave">是否直接保存 (无配药流程)</param>
 /// <param name="isUpdateAdjustParam">是否更新处方调剂参数</param>
 /// <returns>发药确认成功返回1 失败返回-1</returns>
 internal static int OutpatientSend(List <ApplyOut> applyOutCollection, NeuObject terminal, NeuObject sendDept, NeuObject sendOper, bool isDirectSave, bool isUpdateAdjustParam)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy( );
     if (pharmacyIntegrate.OutpatientSend(applyOutCollection, terminal, sendDept, sendOper, isDirectSave, isUpdateAdjustParam) != 1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #6
0
 /// <summary>
 /// 门诊还药操作 对已配药确认的数据 更新为未打印状态
 /// </summary>
 /// <param name="applyOutCollection">摆药申请信息</param>
 /// <param name="backOper">还药人员信息</param>
 /// <returns>成功返回1 失败返回-1</returns>
 internal static int OutpatientBack(List <ApplyOut> applyOutCollection, NeuObject backOper)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy( );
     if (pharmacyIntegrate.OutpatientBack(applyOutCollection, backOper) != 1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #7
0
 /// <summary>
 ///  配置中心收费
 /// </summary>
 /// <param name="arrayApplyOut">住院配置数据</param>
 /// <param name="execDept">执行科室</param>
 /// <returns>成功返回1 失败返回-1</returns>
 internal static int CompoundFee(ArrayList arrayApplyOut, Neusoft.FrameWork.Models.NeuObject execDept, System.Data.IDbTransaction trans)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
     if (pharmacyIntegrate.CompoundFee(arrayApplyOut, execDept, trans) != 1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #8
0
 /// <summary>
 ///  配置中心收费
 /// </summary>
 /// <param name="arrayApplyOut">住院配置数据</param>
 /// <param name="execDept">执行科室</param>
 /// <returns>成功返回1 失败返回-1</returns>
 internal static int CompoundFee(ArrayList arrayApplyOut, Neusoft.FrameWork.Models.NeuObject execDept, System.Data.IDbTransaction trans)
 {
     Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
     //{0C5037B6-06FB-4dd8-AED8-B7412D2A6576}  更改对返回值的判断 仅判断是否为-1
     if (pharmacyIntegrate.CompoundFee(arrayApplyOut, execDept, trans) == -1)
     {
         System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
         return(-1);
     }
     return(1);
 }
Пример #9
0
        /// <summary>
        /// 检查库存
        /// </summary>
        /// <param name="iCheck"></param>
        /// <param name="itemID"></param>
        /// <param name="itemName"></param>
        /// <param name="deptCode"></param>
        /// <param name="qty"></param>
        /// <returns></returns>
        public static bool CheckPharmercyItemStock(int iCheck, string itemID, string itemName, string deptCode, decimal qty)
        {
            //Neusoft.HISFC.Manager.Item manager = new Neusoft.HISFC.BizLogic.Pharmacy.Item();
            //Neusoft.HISFC.Models.Pharmacy.item item = null;
            //.
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaManager = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            Neusoft.HISFC.Models.Pharmacy.Storage phaItem = null;


            switch (iCheck)
            {
            case 0:
                phaItem = phaManager.GetItemForInpatient(deptCode, itemID);
                if (phaItem == null)
                {
                    return(true);
                }
                if (qty > Neusoft.FrameWork.Function.NConvert.ToDecimal(phaItem.StoreQty))
                {
                    return(false);
                }
                break;

            case 1:
                phaItem = phaManager.GetItemForInpatient(deptCode, itemID);


                if (phaItem == null)
                {
                    return(true);
                }
                if (qty > Neusoft.FrameWork.Function.NConvert.ToDecimal(phaItem.StoreQty))
                {
                    if (MessageBox.Show("药品【" + itemName + "】的库存不够!是否继续执行!", "提示库存不足", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case 2:
                break;

            default:
                return(true);
            }
            return(true);
        }
Пример #10
0
        /// <summary>
        /// 对用户确认的出库申请数组进行发药处理(打印摆药单)
        /// writed by cuipeng
        /// 2005-1
        /// 操作如下:
        /// 1、如果该记录未计费,则
        ///		确定摆药是否对药品数量取整(只对每次量取整),确定数量。
        ///		取最新的药品基本信息
        ///	2、更新医嘱执行档(摆药确认信息)
        ///	3、更新药嘱主档的最新的执行信息
        ///	4、如果摆药的同时需要出库则处理出库数据,否则,只确认不处理出库数据
        ///	5、更新出库申请表中的摆药信息
        ///	6、如果全部核准,则更新摆药通知信息。否则不更新摆药通知信息
        ///	摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中
        /// </summary>
        /// <param name="arrayApplyOut">出库申请信息</param>
        /// <param name="drugMessage">摆药通知,用来更新摆药通知(摆药后产生的摆药单保存在drugMessage.DrugBillClass.Memo中)</param>
        /// <returns>1成功,-1失败</returns>
        internal static int DrugConfirm(ArrayList arrayApplyOut, Neusoft.HISFC.Models.Pharmacy.DrugMessage drugMessage, Neusoft.FrameWork.Models.NeuObject arkDept, Neusoft.FrameWork.Models.NeuObject approveDept, System.Data.IDbTransaction trans)
        {
            //对申请项目按照项目编码排序 减少资源死锁的发生几率 {1B35A424-0127-42ff-96A4-6835D5DB0151}
            Neusoft.HISFC.BizProcess.Integrate.PharmacyMethod.SortApplyOutByItemCode(ref arrayApplyOut);

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            if (pharmacyIntegrate.InpatientDrugConfirm(arrayApplyOut, drugMessage, arkDept, approveDept, trans) != 1)
            {
                System.Windows.Forms.MessageBox.Show(pharmacyIntegrate.Err);
                return(-1);
            }
            return(1);
        }
Пример #11
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在加载基础数据 请稍候...");
            Application.DoEvents();

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            List <Neusoft.HISFC.Models.Pharmacy.Item>   phaList           = pharmacyIntegrate.QueryItemList(true);

            if (phaList == null)
            {
                MessageBox.Show(Language.Msg("加载药品列表发生错误!") + pharmacyIntegrate.Err);
                return;
            }
            foreach (Neusoft.HISFC.Models.Pharmacy.Item info in phaList)
            {
                info.Memo = info.Specs;
            }

            this.alDrugList = new ArrayList(phaList.ToArray());
            this.drugHelper = new Neusoft.FrameWork.Public.ObjectHelper(this.alDrugList);

            Neusoft.FrameWork.WinForms.Classes.MarkCellType.NumCellType markNumCell = new Neusoft.FrameWork.WinForms.Classes.MarkCellType.NumCellType();
            this.fsStencil_Sheet1.Columns[4].CellType = markNumCell;
            this.fsStencil_Sheet1.Columns[5].CellType = markNumCell;

            this.stencilItemTypeList = Neusoft.HISFC.Models.Preparation.EnumStencilItemTypeService.List();
            string[] strItemType = new string[this.stencilItemTypeList.Count];
            int      i           = 0;

            foreach (Neusoft.FrameWork.Models.NeuObject tempItemType in this.stencilItemTypeList)
            {
                strItemType[i] = tempItemType.Name;
                i++;
            }

            FarPoint.Win.Spread.CellType.ComboBoxCellType itemTypeCombo = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
            itemTypeCombo.Items = strItemType;
            this.fsStencil_Sheet1.Columns[2].CellType = itemTypeCombo;

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();

            FarPoint.Win.Spread.InputMap im;
            im = this.fsStencil.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
            im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.None);
        }
Пример #12
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            List <Neusoft.HISFC.Models.Pharmacy.Item>   phaList           = pharmacyIntegrate.QueryItemList(true);

            if (phaList == null)
            {
                MessageBox.Show(Language.Msg("加载药品列表发生错误!") + pharmacyIntegrate.Err);
                return;
            }
            foreach (Neusoft.HISFC.Models.Pharmacy.Item info in phaList)
            {
                info.Memo = info.Specs;
            }

            this.alDrugList = new ArrayList(phaList.ToArray());
            this.drugHelper = new Neusoft.FrameWork.Public.ObjectHelper(this.alDrugList);
        }
Пример #13
0
        // private FarPoint.Win.Spread.SheetView view = new FarPoint.Win.Spread.SheetView();

        public void setPrintInfo(ArrayList alorder)
        {
            if (this.fpSpread1_Sheet1.Rows.Count > 0)
            {
                this.fpSpread1_Sheet1.Rows.Remove(0, this.fpSpread1_Sheet1.Rows.Count);
            }

            foreach (Neusoft.HISFC.Models.Order.OutPatient.Order ord in alorder)
            {
                int count = this.fpSpread1_Sheet1.Rows.Count;
                Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaManagement = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
                this.fpSpread1_Sheet1.Rows.Add(count, 1);

                count = this.fpSpread1_Sheet1.Rows.Count;

                this.fpSpread1_Sheet1.Cells[count - 1, 0].Text = ord.Item.Name;
                this.fpSpread1_Sheet1.Cells[count - 1, 1].Text = ord.Item.Specs;
                this.fpSpread1_Sheet1.Cells[count - 1, 5].Text = ord.DoseOnce.ToString() + ord.DoseUnit;
                this.fpSpread1_Sheet1.Cells[count - 1, 7].Text = ord.Frequency.Name;
                this.fpSpread1_Sheet1.Cells[count - 1, 6].Text = ord.Usage.Name;
                Neusoft.HISFC.Models.Pharmacy.Item phaItem = phaManagement.GetItem(ord.Item.ID);
                if (ord.NurseStation.User03 == "1")
                {
                    this.fpSpread1_Sheet1.Cells[count - 1, 8].Text = ord.Qty.ToString() + ord.Unit;
                }
                else
                {
                    this.fpSpread1_Sheet1.Cells[count - 1, 8].Text = Convert.ToString(ord.Qty * ord.Item.PackQty) + phaItem.MinUnit;
                }

                this.fpSpread1_Sheet1.Cells[count - 1, 10].Text = ord.Memo;

                //Neusoft.HISFC.Components.Order.Classes.Function.DrawCombo(this.fpSpread1_Sheet1, 2, 4, 0);

                this.lblRecipeNO.Text = ord.ReciptNO;
            }
        }
Пример #14
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在加载基础数据 请稍候...");
            Application.DoEvents();

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            List <Neusoft.HISFC.Models.Pharmacy.Item>   phaList           = pharmacyIntegrate.QueryItemList(true);

            if (phaList == null)
            {
                MessageBox.Show(Language.Msg("加载药品列表发生错误!") + pharmacyIntegrate.Err);
                return;
            }
            foreach (Neusoft.HISFC.Models.Pharmacy.Item info in phaList)
            {
                info.Memo = info.Specs;
            }

            this.alDrugList = new ArrayList(phaList.ToArray());
            this.drugHelper = new Neusoft.FrameWork.Public.ObjectHelper(this.alDrugList);

            FarPoint.Win.Spread.InputMap im;
            im = this.fsMaterial.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
            im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.None);

            Neusoft.FrameWork.WinForms.Classes.MarkCellType.NumCellType markNumCell = new Neusoft.FrameWork.WinForms.Classes.MarkCellType.NumCellType();
            this.fsMaterial_Sheet1.Columns[(int)MaterialColumnSet.ColQty].CellType = markNumCell;

            this.fsMaterial.PhaListColumnIndex = 1;
            this.fsMaterial.PhaListEnabled     = true;
            this.fsMaterial.Init();

            this.GetInterface();

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
        }
Пример #15
0
        /// <summary>
        /// 查询
        /// </summary>
        protected void Query()
        {
            if (this.cmbDept.Tag == null || this.cmbDept.Tag.ToString() == "")
            {
                MessageBox.Show(Language.Msg("请选择查询库房"));
                return;
            }
            if (!this.ckIgnoreDoc.Checked)
            {
                if (this.cmbDoc.Tag == null || this.cmbDoc.Tag.ToString() == "")
                {
                    MessageBox.Show(Language.Msg("请选择医生"));
                    return;
                }
            }

            Neusoft.HISFC.BizLogic.Pharmacy.Item        itemManager  = new Neusoft.HISFC.BizLogic.Pharmacy.Item();
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy integratePha = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            string deptCode = this.cmbDept.Tag.ToString();
            string docCode  = "";
            string docGrade = "";

            if (!this.ckIgnoreDoc.Checked && this.cmbDoc.Tag != null)
            {
                docCode = this.cmbDoc.Tag.ToString();

                Neusoft.HISFC.BizLogic.Manager.Person personManager = new Neusoft.HISFC.BizLogic.Manager.Person();
                Neusoft.HISFC.Models.Base.Employee    person        = personManager.GetPersonByID(docCode);

                docGrade = person.Level.ID;
            }

            this.dt.Rows.Clear();

            List <Neusoft.HISFC.Models.Pharmacy.Item> alList = new List <Neusoft.HISFC.Models.Pharmacy.Item>();
            ArrayList alArrList = new ArrayList();

            if (!this.ckIgnoreDoc.Checked)
            {
                alList = integratePha.QueryItemAvailableList(deptCode, docCode, docGrade);

                if (alList == null)
                {
                    MessageBox.Show(integratePha.Err);
                    return;
                }

                this.AddDataToTable(alList);

                MessageBox.Show(Language.Msg("查询完成"));
            }
            else
            {
                alArrList = itemManager.QueryItemAvailableList(deptCode);

                if (alArrList == null)
                {
                    MessageBox.Show(itemManager.Err);
                    return;
                }

                this.AddDataToTable(alArrList);

                MessageBox.Show(Language.Msg("查询完成"));
            }
        }
Пример #16
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            DialogResult rs = MessageBox.Show(Language.Msg("确认向" + this.phaOutManager.TargetDept.Name + "进行申请出库操作吗?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (rs == DialogResult.No)
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在保存申请信息 请稍候...");
            Application.DoEvents();

            #region 事务定义

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

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            //phaIntegrate.SetTrans(t.Trans);

            #endregion

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            string applyListNO = "";

            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = dr["药品编码"].ToString() + dr["批号"].ToString();

                Neusoft.HISFC.Models.Pharmacy.ApplyOut applyOut = this.hsApplyData[key] as Neusoft.HISFC.Models.Pharmacy.ApplyOut;

                if (applyOut.ID != "")
                {
                    applyListNO = applyOut.BillNO;          //申请单号

                    #region 对原始申请信息进行修改 只需更新申请数量

                    if (this.isUseMinUnit)
                    {
                        applyOut.Operation.ApplyQty = NConvert.ToDecimal(dr["申请数量"]);       //申请数量
                    }
                    else
                    {
                        applyOut.Operation.ApplyQty = NConvert.ToDecimal(dr["申请数量"]) * applyOut.Item.PackQty; //申请数量
                    }
                    applyOut.Memo = dr["备注"].ToString();                                                      //备注

                    int parm = this.itemManager.UpdateApplyOutNum(applyOut.ID, applyOut.Operation.ApplyQty);
                    if (parm == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg(this.itemManager.Err);
                        return;
                    }
                    else if (parm == 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("该申请单已被审核!无法进行修改!请刷新重试");
                        return;
                    }

                    #endregion
                }
                else
                {
                    #region 新增加申请信息

                    if (applyListNO == "")
                    {
                        // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                        applyListNO = phaIntegrate.GetInOutListNO(this.phaOutManager.DeptInfo.ID, false);
                        if (applyListNO == null)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Function.ShowMsg("获取申请单信息发生错误" + phaIntegrate.Err);
                            return;
                        }
                    }

                    applyOut.BillNO = applyListNO;                                          //申请单据号
                    applyOut.Operation.ApplyOper.ID       = this.phaOutManager.OperInfo.ID; //申请人信息
                    applyOut.Operation.ApplyOper.OperTime = sysTime;
                    applyOut.State = "0";                                                   //申请单状态

                    applyOut.Operation.Oper = applyOut.Operation.ApplyOper;

                    if (this.isUseMinUnit)
                    {
                        applyOut.Operation.ApplyQty = NConvert.ToDecimal(dr["申请数量"]);       //申请数量
                    }
                    else
                    {
                        applyOut.Operation.ApplyQty = NConvert.ToDecimal(dr["申请数量"]) * applyOut.Item.PackQty; //申请数量
                    }
                    applyOut.Memo = dr["备注"].ToString();                                                      //备注

                    if (this.itemManager.InsertApplyOut(applyOut) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg(this.itemManager.Err);
                        return;
                    }

                    #endregion
                }
            }

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

            //for (int i = 0; i < this.dt.DefaultView.Count; i++)
            //{
            //    this.dt.DefaultView[i].BeginEdit();
            //}

            Function.ShowMsg("保存成功");

            this.Clear();
        }
Пример #17
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            DialogResult rs = MessageBox.Show(Language.Msg("确认向" + this.phaOutManager.TargetDept.Name + "进行出库操作吗?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (rs == DialogResult.No)
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在进行保存操作..请稍候");
            System.Windows.Forms.Application.DoEvents();

            #region 事务定义
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            Neusoft.HISFC.BizLogic.Pharmacy.Constant    phaCons      = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            //phaIntegrate.SetTrans(t.Trans);
            //phaCons.SetTrans(t.Trans);

            #endregion

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();
            //判断领用科室是否管理库存
            string outListNO      = "";
            bool   isManagerStore = phaCons.IsManageStore(this.phaOutManager.TargetDept.ID);

            this.alPrintData = new ArrayList();

            //均价出库 只扣减本科室库存 以购入价乘以百分比做为均价出库
            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = dr["药品编码"].ToString() + dr["批号"].ToString();
                Neusoft.HISFC.Models.Pharmacy.Output output = this.hsOutData[key] as Neusoft.HISFC.Models.Pharmacy.Output;

                output.Operation.ExamOper.ID       = this.phaOutManager.OperInfo.ID; //审核人
                output.Operation.ExamOper.OperTime = sysTime;                        //审核日期
                output.Operation.Oper = output.Operation.ExamOper;                   //操作信息

                #region 获取单据号

                if (outListNO == "")
                {
                    // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                    outListNO = phaIntegrate.GetInOutListNO(this.phaOutManager.DeptInfo.ID, false);
                    if (outListNO == null)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("获取新出库单号出错" + phaIntegrate.Err);
                        return;
                    }
                }

                output.OutListNO = outListNO;

                #endregion

                #region Output实体必要信息赋值

                if (this.isUseMinUnit)                                                      //使用最小单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["出库数量"]);                       //出库数量
                }
                else                                                                        //使用包装单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["出库数量"]) * output.Item.PackQty; //出库数量
                }
                output.StoreQty  = output.StoreQty - output.Quantity;
                output.StoreCost = output.StoreQty * output.Item.PriceCollection.RetailPrice / output.Item.PackQty;

                output.Operation.ExamQty = output.Quantity;                     //审核数量
                output.Memo         = dr["备注"].ToString();
                output.DrugedBillNO = "0";                                      //摆药单号 不能为空

                output.GetPerson = this.phaOutManager.TargetPerson.ID;          //领药人

                //状态固定赋值为2
                output.State = "2";         //核准
                output.Operation.ApproveOper = output.Operation.Oper;

                #endregion

                #region 以下信息在每次添加新数据时自动生成

                output.PrivType   = this.phaOutManager.PrivType.ID;             //出库类型
                output.SystemType = this.phaOutManager.PrivType.Memo;           //系统类型
                output.StockDept  = this.phaOutManager.DeptInfo;                //当前科室
                output.TargetDept = this.phaOutManager.TargetDept;              //目标科室

                #endregion

                if (this.itemManager.Output(output, null, false) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Function.ShowMsg("出库保存发生错误" + this.itemManager.Err);
                    return;
                }

                this.alPrintData.Add(output);
            }

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

            Function.ShowMsg("保存成功");

            DialogResult rsPrint = MessageBox.Show(Language.Msg("是否打印出库单?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rsPrint == DialogResult.Yes)
            {
                this.Print();
            }

            this.Clear();
        }
        /// <summary>
        /// 设置新医嘱
        /// </summary>
        public virtual void SetOrder()
        {
            if (this.DesignMode)
            {
                return;
            }
            //定义个新医嘱对象
            this.order = new Neusoft.HISFC.Models.Order.OutPatient.Order();//重新设置医嘱

            dirty = false;
            try
            {
                if (this.ucInputItem1.FeeItem.ID == "999")//自己录的项目
                {
                    this.order.Item = this.ucInputItem1.FeeItem as Neusoft.HISFC.Models.Base.Item;
                }
                else
                {
                    //药品
                    if (this.ucInputItem1.FeeItem.GetType() == typeof(Neusoft.HISFC.Models.Pharmacy.Item))
                    {
                        if (pharmacyManager == null)
                        {
                            pharmacyManager = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
                        }
                        this.order.Item        = pharmacyManager.GetItem(this.ucInputItem1.FeeItem.ID);
                        this.order.Item.User01 = this.ucInputItem1.FeeItem.User01;
                        this.order.Item.User02 = this.ucInputItem1.FeeItem.User02;//传递取药药房
                        this.order.Item.User03 = this.ucInputItem1.FeeItem.User03;
                    }
                    else//非药品
                    {
                        try
                        {
                            if (((Neusoft.HISFC.Models.Base.Item) this.ucInputItem1.FeeItem).PriceUnit != "[复合项]")
                            {
                                Neusoft.HISFC.Models.Fee.Item.Undrug itemTemp = null;
                                itemTemp = itemManager.GetItem(this.ucInputItem1.FeeItem.ID);

                                this.order.Item = itemTemp;

                                //执行科室赋值 开立项目同时赋值执行科室
                                //----Edit By liangjz 07-03
                                if (itemTemp.ExecDept != null && itemTemp.ExecDept != "")
                                {
                                    this.order.ExeDept.ID = itemTemp.ExecDept;
                                }
                                else
                                {
                                    this.order.ExeDept = this.order.Patient.PVisit.PatientLocation.Dept.Clone();
                                }
                                //-----

                                //检查要求是否为空 暂时由此判断该项目为检查还是检验
                                if (itemTemp.SysClass.ID.ToString() == "UL")
                                {
                                    //设置复合项目明细所属大项编码、样本类型/检查部位
                                    this.order.Sample.Name = itemTemp.CheckBody;
                                }
                                else
                                {
                                    this.order.CheckPartRecord = itemTemp.CheckBody;
                                }
                            }
                            else
                            {
                                Neusoft.HISFC.Models.Fee.Item.Undrug itemTemp = null;
                                itemTemp        = (Neusoft.HISFC.Models.Fee.Item.Undrug) this.ucInputItem1.FeeItem;
                                this.order.Item = itemTemp;
                                //检查要求是否为空 暂时由此判断该项目为检查还是检验
                                if (itemTemp.SysClass.ID.ToString() == "UL")
                                {
                                    //设置复合项目明细所属大项编码、样本类型/检查部位
                                    this.order.Sample.Name = itemTemp.CheckBody;
                                }
                                else
                                {
                                    this.order.CheckPartRecord = itemTemp.CheckBody;
                                }
                                this.order.Item.MinFee.ID = "fh";
                            }
                        }
                        catch { MessageBox.Show("转换出错!", "ucItemSelect"); }
                    }
                }
            }
            catch { return; }


            //显示给界面
            if (ReadOrder(this.order) == -1)
            {
                return;
            }

            //设置医嘱开立时间
            Neusoft.FrameWork.Management.DataBaseManger manager = new Neusoft.FrameWork.Management.DataBaseManger();
            DateTime dtNow = manager.GetDateTimeFromSysDateTime();

            this.order.MOTime         = dtNow; //开立时间
            this.order.BeginTime      = dtNow; //开始时间
            this.order.Item.PriceUnit = this.cmbUnit.Text;
            this.order.Unit           = this.cmbUnit.Text;

            this.order.ReciptDept = ((Neusoft.HISFC.Models.Base.Employee)Neusoft.FrameWork.Management.Connection.Operator).Dept.Clone(); //开立科室
            this.order.Oper.ID    = Neusoft.FrameWork.Management.Connection.Operator.ID;                                                 //录入人
            this.order.Oper.Name  = Neusoft.FrameWork.Management.Connection.Operator.Name;

            //医嘱类型
            //this.order.OrderType = this.cmbOrderType1.alItems[this.cmbOrderType1.SelectedIndex] as Neusoft.HISFC.Models.Order.OrderType;


            if (this.txtQTY.Enabled)
            {
                this.txtQTY.Focus();//focus
                this.txtQTY.Select(0, this.txtQTY.Value.ToString().Length);
            }
            else
            {
                this.ucOrderInputByType1.Focus();
            }
            if (this.cmbUnit.Items.Count > 0)
            {
                this.cmbUnit.SelectedIndex = 0;    //默认选择第一个。
            }
            this.ucOrderInputByType1.IsNew = true; //新的

            //初始化新项目信息 设置医嘱频次用法

            if (this.order.Item.GetType() == typeof(Neusoft.HISFC.Models.Pharmacy.Item))
            {
                //this.order.Frequency.ID = "PRN";
                this.order.Usage.ID   = (this.order.Item as Neusoft.HISFC.Models.Pharmacy.Item).Usage.ID;
                this.order.Usage.Name = Order.Classes.Function.HelperUsage.GetName(this.order.Usage.ID);
            }
            else
            {
                //this.order.Frequency.ID = "QD";
            }

            if (this.order.HerbalQty == 0)
            {
                this.order.HerbalQty = 1;                //更新草药付数
            }
            this.ucOrderInputByType1.Order = this.order; //传递给选择类型
            dirty = true;
            this.myOrderChanged(this.order, EnumOrderFieldList.Item);
        }
Пример #19
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            //{37D3D84C-702A-4090-8CB0-B9993279C735}   为了实现暂存 每次处理全部数据
            //if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            //    return;

            //{0084F0DF-44E5-4fe9-9DBC-E92CFCDC0636} 实现内部入库申请单打印
            this.alPrintData.Clear();

            //定义事务
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

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

            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            if (this.listNO == "")
            {
                #region 获取新申请单据号

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

                Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
                //phaIntegrate.SetTrans(t.Trans);

                // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                listNO = phaIntegrate.GetInOutListNO(this.phaInManager.DeptInfo.ID, false);
                if (listNO == null)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    System.Windows.Forms.MessageBox.Show(Language.Msg("获取新申请单据号发生错误" + this.itemManager.Err));
                    return;
                }

                #endregion
            }

            ////{37D3D84C-702A-4090-8CB0-B9993279C735}  入库申请暂存 是否暂存数据
            bool   isTemporaryData = false;
            string msg             = "保存申请成功";

            //{37D3D84C-702A-4090-8CB0-B9993279C735}  入库申请暂存
            foreach (DataRow dr in this.dt.Rows)
            {
                Neusoft.HISFC.Models.Pharmacy.ApplyOut applyOut = this.hsApplyData[this.GetKey(dr)] as Neusoft.HISFC.Models.Pharmacy.ApplyOut;

                #region 申请单信息赋值

                applyOut.Operation.ApplyOper.OperTime = sysTime;

                applyOut.Memo = dr["备注"].ToString();

                if (this.isBack)
                {
                    if (!this.IsEnoughStore(applyOut.Item.ID, applyOut.Operation.ApplyQty))
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        System.Windows.Forms.MessageBox.Show(Language.Msg(applyOut.Item.Name + " 库存数量小于本次退库申请数量 请调整退库数量"));
                        return;
                    }
                }

                applyOut.Operation.ApplyQty = Neusoft.FrameWork.Function.NConvert.ToDecimal(dr["申请数量"]) * applyOut.Item.PackQty;

                #endregion

                //{37D3D84C-702A-4090-8CB0-B9993279C735}   入库申请暂存
                if (isTemporaryFun)     //选择了暂存操作
                {
                    if (applyOut.State == "0" && (string.IsNullOrEmpty(applyOut.ID) == false))
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show("存在已提交数据 不能进行申请单暂存操作,请选择保存进行提交", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    applyOut.State = "A";

                    msg = "暂存申请成功";
                }

                if (applyOut.ID == "")
                {
                    #region 新产生数据

                    applyOut.BillNO = this.listNO;              //申请单据号

                    if (this.itemManager.InsertApplyOut(applyOut) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg(this.itemManager.Err));
                        return;
                    }

                    #endregion
                }
                else
                {
                    #region 更新原有数据

                    int parm = this.itemManager.UpdateApplyOutNum(applyOut.ID, applyOut.Operation.ApplyQty);
                    if (parm == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        System.Windows.Forms.MessageBox.Show(Language.Msg("对申请数量进行更新失败" + this.itemManager.Err));
                        return;
                    }
                    if (parm == 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        System.Windows.Forms.MessageBox.Show(Language.Msg("该申请单已被审核!无法进行修改!请刷新重试"));
                        return;
                    }

                    #endregion
                }

                //{37D3D84C-702A-4090-8CB0-B9993279C735}   入库申请暂存    设置是否存在暂存数据
                if (applyOut.State == "A")
                {
                    isTemporaryData = true;
                }

                //{0084F0DF-44E5-4fe9-9DBC-E92CFCDC0636} 实现内部入库申请单打印
                this.alPrintData.Add(applyOut);
            }

            //{37D3D84C-702A-4090-8CB0-B9993279C735}   入库申请暂存    暂存数据提交
            if (isTemporaryData && (isTemporaryFun == false))
            {
                if (this.itemManager.UpdateApplyOutState(this.phaInManager.DeptInfo.ID, this.listNO, "0") == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("提交入库申请单失败") + this.itemManager.Err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                msg = "提交入库申请成功";
            }

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

            MessageBox.Show(Language.Msg(msg));

            //{0084F0DF-44E5-4fe9-9DBC-E92CFCDC0636} 实现内部入库申请单打印
            if (isTemporaryFun == false)            //非暂存操作
            {
                this.Print();
            }

            this.Clear();
        }
Пример #20
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            //定义事务
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            //获取退库单号
            // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
            string inListNO = phaIntegrate.GetInOutListNO(this.phaInManager.DeptInfo.ID, true);

            if (inListNO == null)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                MessageBox.Show(Language.Msg("获取最新入库单号出错" + itemManager.Err));
                return;
            }

            //标志是否存在保存操作
            bool isSaveOperation = false;

            this.alPrintData = new ArrayList();
            foreach (DataRow dr in dtAddMofity.Rows)
            {
                decimal backQty = NConvert.ToDecimal(dr["退库数量"]);
                if (backQty == 0)
                {
                    continue;
                }

                string key = this.GetKey(dr);
                //{DCE152D1-295C-4cc6-9EAA-39321A234569}
                Neusoft.HISFC.Models.Pharmacy.Input input = (this.hsInData[key] as Neusoft.HISFC.Models.Pharmacy.Input).Clone();

                backQty = backQty * input.Item.PackQty;

                #region 获取本批次当前库存 判断是否允许退库

                decimal storeQty = 0;
                this.itemManager.GetStorageNum(this.phaInManager.DeptInfo.ID, input.Item.ID, input.GroupNO, out storeQty);
                if (storeQty < backQty)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg(input.Item.Name + " 库存数量不足 退库数量过大"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                #endregion

                #region 退库信息赋值

                input.InListNO   = inListNO;                                    //退库单号
                input.Quantity   = -backQty;                                    //入库数量(负数)
                input.RetailCost = input.Quantity / input.Item.PackQty * input.Item.PriceCollection.RetailPrice;
                input.StoreQty   = storeQty + input.Quantity;                   //入库后库存数量
                input.StoreCost  = input.StoreQty / input.Item.PackQty * input.Item.PriceCollection.RetailPrice;

                input.Operation.ApplyOper.ID       = this.phaInManager.OperInfo.ID;
                input.Operation.ApplyOper.OperTime = sysTime;
                input.Operation.Oper = input.Operation.ApplyOper;
                //根据不同发票输入情况及控制参数设置状态
                input.State     = "0";
                input.InvoiceNO = dr["发票号"].ToString();
                if (input.InvoiceNO != "")
                {
                    input.Operation.ExamQty  = input.Quantity;
                    input.Operation.ExamOper = input.Operation.Oper;
                    input.State = "1";                                      //直接更新状态为 审核(发票入库)状态
                }
                if (!this.IsNeedApprove)                                    //不需核准 直接设置状态"2"
                {
                    input.State                 = "2";
                    input.Operation.ExamQty     = input.Quantity;
                    input.Operation.ExamOper    = input.Operation.Oper;
                    input.Operation.ApproveOper = input.Operation.Oper;
                }

                #endregion

                #region 退库保存

                int parm = this.itemManager.Input(input, "1", this.IsNeedApprove ? "0" : "1");
                if (parm == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("保存 [" + input.Item.Name + "] 发生错误 " + this.itemManager.Err));
                    return;
                }
                else if (parm == 0)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("数据可能已被审核,请刷新重试!"));
                    return;
                }

                #endregion

                isSaveOperation = true;

                this.alPrintData.Add(input);
            }

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

            if (isSaveOperation)
            {
                MessageBox.Show(Language.Msg("入库退库操作成功"));

                DialogResult rs = MessageBox.Show(Language.Msg("是否打印退库单?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (rs == DialogResult.Yes)
                {
                    this.Print();
                }
            }

            this.Clear();
        }
Пример #21
0
        protected override int OnSave(object sender, object neuObject)
        {
            if (this.Valid() == false)
            {
                return(-1);
            }

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

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaProcess = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            //操作环境信息
            Neusoft.HISFC.Models.Base.OperEnvironment operEnvironment = new Neusoft.HISFC.Models.Base.OperEnvironment();
            operEnvironment.OperTime = sysTime;
            operEnvironment.ID       = this.itemManager.Operator.ID;
            operEnvironment.Name     = this.itemManager.Operator.Name;
            //当前库存科室
            Neusoft.FrameWork.Models.NeuObject stockDept = ((Neusoft.HISFC.Models.Base.Employee) this.itemManager.Operator).Dept;
            //出库单号
            string outListNO = phaProcess.GetInOutListNO(stockDept.ID, false);
            //入库批次号
            string groupNO = this.itemManager.GetNewGroupNO();

            if (groupNO == null)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                MessageBox.Show("获取新协定处方批次号发生错误 " + this.itemManager.Err);
                return(-1);
            }

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("协定处方包装库存处理...");
            Application.DoEvents();

            for (int i = 0; i < this.fpPackageList_Sheet1.Rows.Count; i++)
            {
                //1. 获取当前进行包装处理的协定处方
                Neusoft.HISFC.Models.Pharmacy.Item selectNostrum = this.fpPackageList_Sheet1.Rows[i].Tag as Neusoft.HISFC.Models.Pharmacy.Item;
                //计划数量
                decimal planQty = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.fpPackageList_Sheet1.Cells[i, (int)ColPackageList.ColPlanQty].Text);

                Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在对 " + selectNostrum.Name + "  进行库存处理");
                Application.DoEvents();
                //2. 获取协定处方构成明细
                List <Neusoft.HISFC.Models.Pharmacy.Nostrum> detailNostrumList = this.fpPackageList_Sheet1.Cells[i, (int)ColPackageList.ColDetail].Tag as List <Neusoft.HISFC.Models.Pharmacy.Nostrum>;
                if (detailNostrumList == null)
                {
                    detailNostrumList = this.itemManager.QueryNostrumDetail(selectNostrum.ID);
                }
                //3. 根据协定处方构成明细,对明细药品进行出库处理
                foreach (Neusoft.HISFC.Models.Pharmacy.Nostrum info in detailNostrumList)
                {
                    #region 处方明细出库

                    //3.1 对明细药品逐条进行出库处理
                    Neusoft.HISFC.Models.Pharmacy.Item detailItem = this.itemManager.GetItem(info.Item.ID);
                    if (detailItem == null)
                    {
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show("处理处方明细出库,根据药品编码获取药品名称发生错误 " + this.itemManager.Err);
                        return(-1);
                    }

                    //info.Qty 即协定处方维护内的数量即为生产1单位成品所需的数量,此处直接相乘即所需明细的最小单位库存量
                    decimal outQty = planQty * info.Qty;

                    if (this.itemManager.NostrumPackageOutput(detailItem, outQty, stockDept, operEnvironment, outListNO) == -1)
                    {
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show("处理处方明细出库,进行出库操作发生错误 " + this.itemManager.Err);
                        return(-1);
                    }

                    #endregion
                }
                //4. 对协定处方进行入库处理

                #region 处方入库处理

                Neusoft.HISFC.Models.Pharmacy.Input input = new Neusoft.HISFC.Models.Pharmacy.Input();

                decimal inQty = planQty * selectNostrum.PackQty;

                #region 实体赋值

                input.Class2Type = "0310";
                input.SystemType = Neusoft.HISFC.Models.Base.EnumIMAInTypeService.GetNameFromEnum(Neusoft.HISFC.Models.Base.EnumIMAInType.ProduceInput); //系统类型=出库申请类型;				//"R1" 制剂管理类型
                input.PrivType   = input.SystemType;                                                                                                     //制剂管理类型
                input.InListNO   = outListNO;

                input.Item = selectNostrum;

                input.StockDept = stockDept;
                input.Company   = stockDept;
                input.Producer  = stockDept;

                input.TargetDept = stockDept;
                input.GroupNO    = Neusoft.FrameWork.Function.NConvert.ToDecimal(groupNO);

                input.BatchNO = this.fpPackageList_Sheet1.Cells[i, (int)ColPackageList.ColBatchNO].Text;
                if (string.IsNullOrEmpty(input.BatchNO) == true)
                {
                    input.BatchNO = "1";
                }
                input.ValidTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.fpPackageList_Sheet1.Cells[i, (int)ColPackageList.ColValidDate].Text);
                if (input.ValidTime < sysTime)
                {
                    input.ValidTime = sysTime.AddYears(10);
                }

                input.Quantity           = inQty;
                input.Operation.ApplyQty = inQty;
                input.Operation.ExamQty  = inQty;

                input.Operation.ApplyOper = operEnvironment;

                input.State = "2";
                input.Operation.ExamOper    = operEnvironment;
                input.Operation.ApproveOper = operEnvironment;

                #endregion

                #region 购入价计算

                ArrayList alOutputList = this.itemManager.QueryOutputInfo(stockDept.ID, outListNO, "A");
                if (alOutputList != null)
                {
                    input.PurchaseCost = 0;
                    foreach (Neusoft.HISFC.Models.Pharmacy.Output outputTemp in alOutputList)
                    {
                        input.PurchaseCost += outputTemp.PurchaseCost;
                    }

                    input.PriceCollection.PurchasePrice = Math.Round(input.PurchaseCost / (input.Quantity / input.Item.PackQty), 4);
                }

                #endregion

                if (this.itemManager.Input(input, "1") == -1)
                {
                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("处理处方成品入库,进行入库操作发生错误 " + this.itemManager.Err);
                    return(-1);
                }

                #endregion
            }

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();

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

            MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Clear();

            return(1);
        }
Пример #22
0
        /// <summary>
        /// 身份变更确认操作
        /// </summary>
        /// <returns></returns>
        protected virtual int ChangePact()
        {
            if (this.IsValid() < 0)
            {
                return(-1);
            }
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在处理明细数据……");
            Application.DoEvents();
            Neusoft.FrameWork.Models.NeuObject newObj = new Neusoft.FrameWork.Models.NeuObject();
            Neusoft.FrameWork.Models.NeuObject oldObj = new Neusoft.FrameWork.Models.NeuObject();
            Neusoft.FrameWork.Models.NeuObject obj    = new Neusoft.FrameWork.Models.NeuObject();
            //备份收费药品信息
            ArrayList alDruglistBackUp = new ArrayList();
            //备份收费药品信息
            ArrayList alUndruglistBackUp = new ArrayList();

            obj = this.GetPactUnitByID(this.cmbNewPact.SelectedItem.ID);

            this.medcareInterfaceProxy.SetPactCode(this.cmbNewPact.SelectedItem.ID);
            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);

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

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            pharmacyIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            this.InpatientManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.myPactUnit.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.radtIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.feeIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            newObj.ID     = this.cmbNewPact.SelectedItem.ID;   //1 合同单位代码
            newObj.Name   = this.cmbNewPact.SelectedItem.Name; //2 合同单位名称
            newObj.User01 = obj.ID;                            //3 结算类别代码
            newObj.User02 = obj.Name;                          //4 结算类别名称
            newObj.User03 = this.patientInfo.SSN;              //医疗证号

            oldObj.ID   = this.txtOldPact.Tag.ToString();
            oldObj.Name = this.txtOldPact.Text;


            #region 退费


            #region 处理非药品



            //处理非药品
            if (this.fpUndrug_Sheet1.RowCount > 0)
            {
                for (int i = 0; i < fpUndrug_Sheet1.RowCount; i++)
                {
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList undrugItem    = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldUndrugItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    if (this.fpUndrug_Sheet1.Rows[i].Tag != null)
                    {
                        undrugItem          = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList) this.fpUndrug_Sheet1.Rows[i].Tag;
                        oldUndrugItem       = undrugItem.Clone();
                        undrugItem.ExtFlag2 = "3";//变更标志
                        //退费



                        undrugItem.IsNeedUpdateNoBackQty = true;
                        if (this.feeIntegrate.QuitItem(this.patientInfo, undrugItem) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                            this.Clear();
                            return(-1);
                        }


                        //收费
                        oldUndrugItem.RecipeNO         = this.InpatientManager.GetUndrugRecipeNO();
                        oldUndrugItem.Patient.Pact.ID  = this.cmbNewPact.SelectedItem.ID;
                        oldUndrugItem.FeeOper.ID       = this.InpatientManager.Operator.ID;
                        oldUndrugItem.FeeOper.OperTime = this.InpatientManager.GetDateTimeFromSysDateTime();
                        //备份非药品信息


                        alUndruglistBackUp.Add(oldUndrugItem);
                        //if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldUndrugItem) == -1)
                        //{
                        //    t.RollBack();
                        //    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        //    MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                        //    this.Clear();
                        //    return -1;
                        //}
                    }
                    else
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                        this.Clear();
                        return(-1);
                    }
                }
            }
            #endregion

            #region 处理药品
            //处理药品
            if (this.fpDrug_Sheet1.RowCount > 0)
            {
                for (int i = 0; i < fpDrug_Sheet1.RowCount; i++)
                {
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList medicineItem    = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldMedicineItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    if (this.fpDrug_Sheet1.Rows[i].Tag != null)
                    {
                        medicineItem          = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList) this.fpDrug_Sheet1.Rows[i].Tag;
                        oldMedicineItem       = medicineItem.Clone();
                        medicineItem.ExtFlag2 = "3";//变更标志
                        //退费

                        ////这里是否更改成未摆药的更新发药申请的记录addbyhuazb
                        //if (string.IsNullOrEmpty(medicineItem.ExecOper.ID))
                        //{
                        //    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        //    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        //    MessageBox.Show("保存出错出错" + "该患者有药未摆,请通知药房摆药以后再进行变更!");
                        //    this.Clear();
                        //    return -1;
                        //}



                        medicineItem.IsNeedUpdateNoBackQty = true;
                        if (this.feeIntegrate.QuitItem(this.patientInfo, medicineItem) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                            this.Clear();
                            return(-1);
                        }


                        //收费
                        //存储旧处方号
                        oldMedicineItem.BalanceOper.User01 = oldMedicineItem.RecipeNO;

                        oldMedicineItem.RecipeNO         = this.InpatientManager.GetDrugRecipeNO();
                        oldMedicineItem.Patient.Pact.ID  = this.cmbNewPact.SelectedItem.ID;
                        oldMedicineItem.FeeOper.ID       = this.InpatientManager.Operator.ID;
                        oldMedicineItem.FeeOper.OperTime = this.InpatientManager.GetDateTimeFromSysDateTime();
                        //备份药品信息
                        alDruglistBackUp.Add(oldMedicineItem);
                        //if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldMedicineItem) == -1)
                        //{
                        //    t.RollBack();
                        //    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        //    MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                        //    this.Clear();
                        //    return -1;
                        //}
                    }
                    else
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                        this.Clear();
                        return(-1);
                    }
                }
            }
            #endregion
            #endregion


            if (this.radtIntegrate.SetPactShiftData(this.patientInfo, newObj, oldObj) != 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show("调用中间层出错");
                this.Clear();
                return(-1);
            }
            //获得更改后得患者信息



            this.oENewPatientInfo = this.radtIntegrate.GetPatientInfomation(this.patientInfo.ID);
            if (this.oENewPatientInfo == null)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show("获得变更后患者信息出错!!", "提示");
                this.Clear();
                return(-1);
            }

            #region 重新收费
            #region 处理非药品


            long returnValue = 0;
            this.medcareInterfaceProxy.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            returnValue = this.medcareInterfaceProxy.Connect();
            if (returnValue < 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                this.medcareInterfaceProxy.Rollback();
                //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16}
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show("请确保待遇接口存在或正常初始化初始化失败" + this.medcareInterfaceProxy.ErrMsg);
                this.Clear();
                return(-1);
            }
            returnValue = this.medcareInterfaceProxy.GetRegInfoInpatient(oENewPatientInfo);
            if (returnValue < 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                this.medcareInterfaceProxy.Rollback();
                //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16}
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show("待遇接口获得患者信息失败" + this.medcareInterfaceProxy.ErrMsg);
                this.Clear();
                return(-1);
            }
            returnValue = this.medcareInterfaceProxy.UploadRegInfoInpatient(oENewPatientInfo);
            if (returnValue < 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                this.medcareInterfaceProxy.Rollback();
                //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16}
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show("待遇接口上传住院登记信息失败" + this.medcareInterfaceProxy.ErrMsg);
                this.Clear();
                return(-1);
            }

            //处理非药品
            if (alUndruglistBackUp.Count > 0)
            {
                for (int i = 0; i < alUndruglistBackUp.Count; i++)
                {
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldUndrugItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    oldUndrugItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList)alUndruglistBackUp[i];
                    if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldUndrugItem) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        this.medcareInterfaceProxy.Rollback();
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                        this.Clear();
                        return(-1);
                    }
                }
            }
            #endregion

            #region 处理药品
            //处理药品
            if (alDruglistBackUp.Count > 0)
            {
                for (int i = 0; i < alDruglistBackUp.Count; i++)
                {
                    Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldMedicineItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList();
                    oldMedicineItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList)alDruglistBackUp[i];
                    if (oldMedicineItem != null)
                    {
                        if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldMedicineItem.Clone()) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            this.medcareInterfaceProxy.Rollback();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                            this.Clear();
                            return(-1);
                        }
                        //这里收费完已经发药的senddrug_flag未更新。addbyhuazb

                        if (this.InpatientManager.UpdateMedItemExecInfo(oldMedicineItem.RecipeNO, oldMedicineItem.SequenceNO
                                                                        , oldMedicineItem.UpdateSequence, oldMedicineItem.SendSequence, (int)oldMedicineItem.PayType, oldMedicineItem.StockOper.Dept.ID,
                                                                        oldMedicineItem.ExecOper.ID, oldMedicineItem.ExecOper.OperTime) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            this.medcareInterfaceProxy.Rollback();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err);
                            this.Clear();
                            return(-1);
                        }
                        //更新处方号
                        if (pharmacyIntegrate.UpdateApplyOutRecipe(oldMedicineItem.BalanceOper.User01, oldMedicineItem.SequenceNO, oldMedicineItem.RecipeNO, oldMedicineItem.SequenceNO) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("更新药品申请表处方号信息发生错误!" + pharmacyIntegrate.Err);
                            this.Clear();
                            return(-1);
                        }
                    }
                }
            }
            #endregion
            #endregion


            Neusoft.FrameWork.Management.PublicTrans.Commit();
            this.medcareInterfaceProxy.Commit();
            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变更成功"));
            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            //重新显示介面
            this.SetpatientInfo(this.oENewPatientInfo);
            //重新显示费用明细
            this.DisplayDetail(this.oENewPatientInfo.ID);

            return(1);
        }
Пример #23
0
        /// <summary>
        /// 打印函数
        /// </summary>
        /// <param name="al">打印数组</param>
        /// <param name="i">第几页</param>
        /// <param name="count">总页数</param>
        /// <param name="operCode">制单人</param>
        private void PrintStockplan(ArrayList al, int inow, int icount, string operCode)
        {
            if (al.Count <= 0)
            {
                MessageBox.Show("没有打印的数据!");
                return;
            }
            Neusoft.HISFC.BizLogic.Pharmacy.Constant    constant    = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
            Neusoft.HISFC.Models.Pharmacy.StockPlan     stockPlan   = (Neusoft.HISFC.Models.Pharmacy.StockPlan)al[0];
            Neusoft.HISFC.BizLogic.Manager.Constant     constantMgr = new Neusoft.HISFC.BizLogic.Manager.Constant();
            Neusoft.HISFC.BizLogic.Manager.Department   deptMgr     = new Neusoft.HISFC.BizLogic.Manager.Department();
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy itemMgr     = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            string strHos   = constantMgr.GetHospitalName();
            string dosageID = string.Empty; //剂型


            if (stockPlan.State == "2")
            {
                this.lbl0.Text = strHos + "药品采购审批单";
            }
            else
            {
                this.lbl0.Text = strHos + "药品采购计划单";
                //label2.Visible = false;
            }

            #region label赋值

            if (this.IsReprint)
            {
                this.lbl0.Text = this.lbl0.Text + "(补打)";
            }

            //DateTime sysTime = this.itemMgr.GetDateTimeFromSysDateTime();
            //this.lb11.Text = "计划科室  " + inPlan.Dept+this.deptMgr.get + " 计划人  " + inPlan.PlanOper.ID;
            this.lb11.Text   = " 计划人:  " + stockPlan.Oper.Name;
            this.lb12.Text   = "计划日期:" + this.itemMgr.GetDateTimeFromSysDateTime().ToString("yyyy-MM-dd");
            this.label2.Text = "采购日期:" + stockPlan.StockOper.OperTime.ToString("yyyy-MM-dd");
            this.lb36.Text   = "第" + inow.ToString() + "页/共" + icount.ToString() + "页";
            this.label1.Text = "单据号:" + stockPlan.BillNO;
            this.label3.Text = "科室:" + deptMgr.GetDeptmentById(stockPlan.Dept.ID);

            #endregion

            #region farpoint赋值

            decimal sumNum5 = 0;
            decimal sumNum8 = 0;
            decimal sumNum9 = 0;
            this.sheetView1.RowCount = 0;

            #region {1EC17564-2FAD-4a77-97AC-4C57076888B2}
            FarPoint.Win.Spread.CellType.NumberCellType numberCellType1 = new FarPoint.Win.Spread.CellType.NumberCellType();
            numberCellType1.DecimalPlaces       = 4;
            this.sheetView1.Columns[6].CellType = numberCellType1;
            this.sheetView1.Columns[7].CellType = numberCellType1;
            this.sheetView1.Columns[8].CellType = numberCellType1;
            #endregion
            for (int i = 0; i < al.Count; i++)
            {
                this.sheetView1.AddRows(i, 1);
                Neusoft.HISFC.Models.Pharmacy.StockPlan info = al[i] as Neusoft.HISFC.Models.Pharmacy.StockPlan;


                this.sheetView1.Cells[i, 0].Text = info.Item.ID;    // info.Item.NameCollection.UserCode;//药品自定义码
                this.sheetView1.Cells[i, 1].Text = info.Item.Name;  //药品名称
                this.sheetView1.Cells[i, 2].Text = info.Item.Specs; //规格
                if (info.Item.PackQty == 0)
                {
                    info.Item.PackQty = 1;
                }

                decimal count = 0, count2 = 0, count3 = 0;
                count  = info.StockApproveQty / info.Item.PackQty;
                count2 = (info.StockApproveQty / info.Item.PackQty) * (info.Item.PriceCollection.PurchasePrice);
                count3 = (info.StockApproveQty / info.Item.PackQty) * (info.Item.PriceCollection.RetailPrice);
                this.sheetView1.Cells[i, 3].Text = info.Item.PackUnit;//单位

                // Neusoft.HISFC.BizProcess.Integrate.Pharmacy itemMgr = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();



                dosageID = ((Neusoft.HISFC.Models.Pharmacy.Item)itemMgr.GetItem(info.Item.ID)).DosageForm.ID;


                this.sheetView1.Cells[i, 4].Text = ((Neusoft.FrameWork.Models.NeuObject)constantMgr.GetConstant("DOSAGEFORM", dosageID)).Name; //info.Item.DosageForm.Name; //剂型
                this.sheetView1.Cells[i, 5].Text = (info.StockApproveQty / info.Item.PackQty).ToString();                                      //计划数量

                this.sheetView1.Cells[i, 6].Text = info.StockPrice.ToString();                                                                 //计划购入价      // info.Item.PackUnit;//
                this.sheetView1.Cells[i, 7].Text = info.Item.Price.ToString();                                                                 //参考零售价


                this.sheetView1.Cells[i, 8].Text = ((info.StockApproveQty / info.Item.PackQty) * (info.StockPrice)).ToString();                       //计划金额
                this.sheetView1.Cells[i, 9].Text = ((info.StockApproveQty / info.Item.PackQty) * (info.Item.PriceCollection.RetailPrice)).ToString(); //零售金额


                //if (info.Item.Product.Company.Name != "")
                //    this.sheetView1.Cells[i, 7].Text = info.Item.Product.Company.Name;         //供货公司;
                //else
                //    this.sheetView1.Cells[i, 7].Text = "未选择";

                if (info.Company.Name != "")
                {
                    this.sheetView1.Cells[i, 10].Text = info.Company.Name;         //供货公司;
                }
                else
                {
                    this.sheetView1.Cells[i, 10].Text = "未选择";
                }

                //if (info.Item.Product.Producer.Name != "")
                //    this.sheetView1.Cells[i, 8].Text = info.Item.Product.Producer.Name;        //生产厂家
                //else
                //    this.sheetView1.Cells[i, 8].Text = "未选择";

                sumNum5 = sumNum5 + count;
                sumNum8 = sumNum8 + count2;
                sumNum9 = sumNum9 + count3;
            }
            this.sheetView1.RowCount = al.Count + 1;
            this.sheetView1.Cells[al.Count, 0].Text = "合计";
            this.sheetView1.Cells[al.Count, 1].Text = "共" + al.Count + "行"; //行数;
            this.sheetView1.Cells[al.Count, 5].Text = sumNum5.ToString();   //购入数量合计
            this.sheetView1.Cells[al.Count, 8].Text = sumNum8.ToString();   //购入金额合计
            this.sheetView1.Cells[al.Count, 9].Text = sumNum9.ToString();   //零售金额合计

            //宽度
            //this.panel4.Width = this.Width - 3;
            this.fpSpread1.Width  = this.panel1.Width - 10;
            this.fpSpread1.Height = (int)this.sheetView1.RowHeader.Rows[0].Height +
                                    (int)(this.sheetView1.Rows[0].Height * (al.Count + 1)) + 10;

            #endregion

            #region 打印函数

            Neusoft.FrameWork.WinForms.Classes.Print p = new Neusoft.FrameWork.WinForms.Classes.Print();

            Neusoft.HISFC.Components.Common.Classes.Function.GetPageSize("PhaInplan", ref p);

            p.PrintPage(5, 0, this.panel1);

            #endregion
        }
Пример #24
0
        /// <summary>
        /// 判断试敏
        /// </summary>
        /// <param name="feeItemLists">费用明细实体</param>
        /// <returns>成功 true 失败 false 错误信息包含在Err属性内</returns>
        protected virtual bool IsAllergyValid(ArrayList feeItemLists)
        {
            this.errText = string.Empty;

            //需要验证过敏结果的药品集合
            List <Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList> pharmarcys = new List <Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList>();

            //药品业务层
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            //医嘱业务层
            Neusoft.HISFC.BizProcess.Integrate.Order orderIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Order();
            //不合法项目列表
            ArrayList unValidList = new ArrayList();

            foreach (Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList f in feeItemLists)
            {
                //如果是药品,并且需要试敏,那么加入以下试敏列表pharmarcys
                if (f.Item.ItemType == Neusoft.HISFC.Models.Base.EnumItemType.Drug)
                {
                    Neusoft.HISFC.Models.Pharmacy.Item itemTemp = pharmacyIntegrate.GetItem(f.Item.ID);
                    if (itemTemp == null)
                    {
                        this.errText = "获得药品基本信息出错!" + pharmacyIntegrate.Err;

                        return(false);
                    }
                    //如果需要试敏,那么加入列表
                    if (itemTemp.IsAllergy)
                    {
                        pharmarcys.Add(f);
                    }
                }
            }

            //如果药品条目为0, 就不用判断试敏
            if (pharmarcys.Count == 0)
            {
                return(true);
            }

            //在医嘱表,判断试敏标记是否已经有值,没有试敏,或者试敏阳性,不能收费!
            foreach (Neusoft.HISFC.Models.Fee.Outpatient.FeeItemList f in pharmarcys)
            {
                //如果没有医嘱号,说明不是医生站开出的医嘱,不判断试敏.
                if (string.IsNullOrEmpty(f.Order.ID))
                {
                    continue;
                }

                Neusoft.HISFC.Models.Order.OutPatient.Order orderTemp = orderIntegrate.GetOneOrder(f.Order.ID);
                //如果没有取出医嘱信息,那么不判断试敏,因为某些从门诊直接披费的项目,也有MoOrder号;
                if (orderTemp == null)
                {
                    continue;
                }

                //需要皮试,但是还没有皮试结果
                if (orderTemp.HypoTest == 2)
                {
                    this.errText += "[ " + f.Item.Name + " ]" + "应该皮试,没有皮试结果!" + "\n";

                    unValidList.Add(f);
                }
                if (orderTemp.HypoTest == 3)
                {
                    this.errText += "[ " + f.Item.Name + " ]" + "皮试结果为阳性!" + "\n";

                    unValidList.Add(f);
                }
            }

            if (unValidList.Count > 0)
            {
                return(false);
            }

            return(true);
        }
Пример #25
0
        public void Save()
        {
            this.phaOutManager.Fp.StopCellEditing();

            if (!this.Valid())
            {
                return;
            }

            DialogResult rs = MessageBox.Show(Language.Msg("确认向" + this.phaOutManager.TargetDept.Name + "进行出库操作吗?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (rs == DialogResult.No)
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            this.phaOutManager.Fp.StopCellEditing();

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在进行保存操作..请稍候");
            System.Windows.Forms.Application.DoEvents();

            #region 事务定义

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

            Neusoft.HISFC.BizLogic.Pharmacy.Constant    phaCons      = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            //phaIntegrate.SetTrans(t.Trans);
            //phaCons.SetTrans(t.Trans);

            #endregion

            DateTime sysTime   = this.itemManager.GetDateTimeFromSysDateTime();
            string   outListNO = "";
            string   inListNO  = "";
            //判断领用科室是否管理库存
            bool isManagerStore = phaCons.IsManageStore(this.phaOutManager.TargetDept.ID);
            //如管理库存 则提示是否确认保存出库
            if (isManagerStore)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();

                DialogResult rsResult = MessageBox.Show(Language.Msg(this.phaOutManager.TargetDept.Name + "管理库存。确认进行出库操作吗?\n出库时将直接更新对方库存"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (rsResult == DialogResult.No)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    return;
                }

                Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在进行保存操作..请稍候");
                System.Windows.Forms.Application.DoEvents();
            }

            //一般出库对应的入库记录
            Neusoft.HISFC.Models.Pharmacy.Input input = null;

            //-------原程序处理方式
            //    //如领用科室管理库存 则只处理出库记录、更新本科室库存 不处理入库记录和领药科室库存 待领药科室入库核准后才处理库存
            //    //如领药科室不管理库存 则处理出库记录、更新本科室库存,试用期间处理入库记录、更新领药科室库存
            //    //						正式使用后不处理入库记录和领药科室库存
            //    //只需对isManagerStore赋值改变 对下边入库记录处理的判断做下修改即可
            //    //更新领药科室库存的操作封装于入库函数内 和入库记录一同处理 可通过传入参数判断是否处理库存
            //-------新程序处理方式
            //      一般出库时,不管目标科室是不是管理库存,都直接设置出库记录状态为已核准。
            //                  目标科室管理库存时,对目标科室产生入库记录,状态为已核准
            //                  目标科室不管理库存时,对目标科室不产生入库记录

            this.alPrintData = new ArrayList();

            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = dr["药品编码"].ToString() + dr["批号"].ToString();
                Neusoft.HISFC.Models.Pharmacy.Output output = this.hsOutData[key] as Neusoft.HISFC.Models.Pharmacy.Output;

                output.Operation.ExamOper.ID       = this.phaOutManager.OperInfo.ID; //审核人
                output.Operation.ExamOper.OperTime = sysTime;                        //审核日期
                output.Operation.Oper = output.Operation.ExamOper;                   //操作信息

                #region 对数据来源为申请的数据进行处理

                if (dr["数据来源"].ToString() == "1")
                {
                    Neusoft.HISFC.Models.Pharmacy.ApplyOut applyOut = this.hsApplyData[output.User02] as Neusoft.HISFC.Models.Pharmacy.ApplyOut;

                    applyOut.State     = "1";                   //状态 审批
                    applyOut.Operation = output.Operation;      //操作信息

                    if (this.itemManager.UpdateApplyOut(applyOut) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("更新" + output.Item.Name + "出库申请信息时出错");
                        return;
                    }

                    if (outListNO == "")
                    {
                        outListNO = applyOut.BillNO;
                    }
                }

                #endregion

                #region 获取单据号

                if (outListNO == "")
                {
                    // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                    outListNO = phaIntegrate.GetInOutListNO(this.phaOutManager.DeptInfo.ID, false);
                    if (outListNO == null)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("获取新出库单号出错" + phaIntegrate.Err);
                        return;
                    }
                }

                output.OutListNO = outListNO;

                #endregion

                #region Output实体必要信息赋值

                if (this.isUseMinUnit)                                                      //使用最小单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["出库数量"]);                       //出库数量
                }
                else                                                                        //使用包装单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["出库数量"]) * output.Item.PackQty; //出库数量
                }
                output.StoreQty  = output.StoreQty - output.Quantity;
                output.StoreCost = output.StoreQty * output.Item.PriceCollection.RetailPrice / output.Item.PackQty;

                output.Operation.ExamQty = output.Quantity;                     //审核数量
                output.Memo         = dr["备注"].ToString();
                output.DrugedBillNO = "0";                                      //摆药单号 不能为空

                output.GetPerson = this.phaOutManager.TargetPerson.ID;          //领药人

                //----原数据处理方式
                //if (isManagerStore)             //目标(领用)科室管理库存
                //    output.State = "1";         //审核
                //else
                //    output.State = "2";         //核准
                //----现处理方式 对于一般出库 直接设置出库状态为2
                output.State = "2";

                if (this.isSpecialOut)          //特殊出库 直接更新状态为核准
                {
                    output.SpecialFlag = "1";
                    output.State       = "2";
                }

                if (output.State == "2")
                {
                    output.Operation.ApproveOper = output.Operation.Oper;
                }

                #endregion

                #region 以下信息在每次添加新数据时自动生成

                output.PrivType   = this.phaOutManager.PrivType.ID;             //出库类型
                output.SystemType = this.phaOutManager.PrivType.Memo;           //系统类型
                output.StockDept  = this.phaOutManager.DeptInfo;                //当前科室
                output.TargetDept = this.phaOutManager.TargetDept;              //目标科室

                #endregion

                #region 形成目标科室的入库记录

                #region 根据领药科室是否管理库存   在不管理库存的情况下才处理入库记录
                if (!this.isSpecialOut)
                {
                    input = new Neusoft.HISFC.Models.Pharmacy.Input();
                    //设置入库单号
                    if (inListNO == "")
                    {
                        // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                        inListNO = phaIntegrate.GetInOutListNO(this.phaOutManager.TargetDept.ID, false);
                        if (inListNO == null)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            MessageBox.Show(Language.Msg("对目标库存科室插入入库记录时获取入库单号出错") + this.itemManager.Err);
                            return;
                        }
                    }

                    //获取关联权限类型 关联权限类型不存在时 设置为默认值
                    if (this.privJoinClass3 != null)
                    {
                        input.PrivType   = this.privJoinClass3.Class3Code;
                        input.SystemType = this.privJoinClass3.Class3MeaningCode;
                    }
                    else
                    {
                        input.PrivType   = "01";                                                                                //一般入库对应的用户类型
                        input.SystemType = "11";                                                                                //一般入库
                    }

                    input.State     = "2";                                              //已审批
                    input.StockDept = this.phaOutManager.TargetDept;                    //库存部门

                    input.TargetDept = this.phaOutManager.DeptInfo;                     //目标科室 供货单位

                    input.InListNO                    = inListNO;                       //入库单据号
                    input.OutListNO                   = outListNO;                      //出库单据号
                    input.Operation.ExamOper.ID       = this.phaOutManager.OperInfo.ID; //审批人
                    input.Operation.ExamOper.OperTime = sysTime;                        //审批日期

                    input.Operation.ApproveOper = input.Operation.ExamOper;
                    input.Operation.ApplyOper   = input.Operation.ExamOper;

                    decimal storeQty = 0;
                    if (this.itemManager.GetStorageNum(this.phaOutManager.TargetDept.ID, output.Item.ID, out storeQty) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("获取" + output.Item.Name + "库存数量时发生错误" + this.itemManager.Err));
                        return;
                    }
                    input.StoreQty = storeQty + output.Quantity;

                    //设置出库记录中对应的入库单据号
                    output.InListNO = inListNO;
                }
                else
                {
                    input = null;
                }
                #endregion

                #endregion


                //原处理方式 第三个参数始终传入False
                if (this.itemManager.Output(output, input, isManagerStore) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Function.ShowMsg("出库保存发生错误" + this.itemManager.Err);
                    return;
                }

                this.alPrintData.Add(output);
            }

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

            //for (int i = 0; i < this.dt.DefaultView.Count; i++)
            //{
            //    this.dt.DefaultView[i].BeginEdit();
            //}

            Function.ShowMsg("保存成功");

            DialogResult rsPrint = MessageBox.Show(Language.Msg("是否打印出库单?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rsPrint == DialogResult.Yes)
            {
                this.Print();
            }


            this.Clear();
        }
Пример #26
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            Neusoft.HISFC.BizLogic.Pharmacy.Constant phaConsManager = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
            bool isManagerStore = phaConsManager.IsManageStore(this.phaOutManager.TargetDept.ID);

            if (!isManagerStore)
            {
                MessageBox.Show(Language.Msg(this.phaOutManager.TargetDept.Name + " 不管理库存,不能通过出库审批进行出库"), "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DialogResult rs = MessageBox.Show(Language.Msg("确认向" + this.phaOutManager.TargetDept.Name + "进行出库操作吗?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (rs == DialogResult.No)
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在进行保存操作..请稍候");
            System.Windows.Forms.Application.DoEvents();

            #region 事务定义

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

            Neusoft.HISFC.BizLogic.Pharmacy.Constant    phaCons      = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            #endregion

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            string outListNO = "";

            this.alPrintData = new ArrayList();

            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = dr["药品编码"].ToString() + dr["批号"].ToString();
                Neusoft.HISFC.Models.Pharmacy.Output output = this.hsOutData[key] as Neusoft.HISFC.Models.Pharmacy.Output;

                if (this.isUseMinUnit)                                                      //使用最小单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["实发数量"]);                       //实发数量
                }
                else                                                                        //使用包装单位
                {
                    output.Quantity = NConvert.ToDecimal(dr["实发数量"]) * output.Item.PackQty; //实发数量
                }
                output.StoreQty     = output.StoreQty - output.Quantity;
                output.StoreCost    = output.StoreQty * output.Item.PriceCollection.RetailPrice / output.Item.PackQty;
                output.Memo         = dr["备注"].ToString();
                output.DrugedBillNO = "0";                                           //摆药单号 不能为空

                output.Operation.ExamOper.ID       = this.phaOutManager.OperInfo.ID; //审核人
                output.Operation.ExamOper.OperTime = sysTime;                        //审核日期
                output.Operation.ExamQty           = output.Quantity;                //审核数量
                output.Operation.Oper = output.Operation.ExamOper;                   //操作信息
                output.GetPerson      = this.phaOutManager.TargetPerson.ID;          //领药人

                output.State = "1";                                                  //状态 审批

                #region 对数据来源为申请的数据进行更新 对本次新添加的数据生成申请信息记录

                if (dr["数据来源"].ToString() == "1")
                {
                    Neusoft.HISFC.Models.Pharmacy.ApplyOut applyOut = this.hsApplyData[output.User02] as Neusoft.HISFC.Models.Pharmacy.ApplyOut;

                    if (outListNO == "")
                    {
                        outListNO = applyOut.BillNO;
                    }

                    decimal tempApproveQty = applyOut.Operation.ApproveQty;
                    applyOut.Operation = output.Operation;              //操作信息
                    //未选择审批标记 只记录本次待发送的数量 不扣库存处理
                    if (!NConvert.ToBoolean(dr["审批"]))
                    {
                        //数量累计
                        applyOut.Operation.ApproveQty = tempApproveQty + output.Quantity;
                        applyOut.State = "0";
                    }
                    else
                    {
                        applyOut.Operation.ApproveOper = output.Operation.Oper;
                        applyOut.State = "2";
                    }

                    // {EE05DA01-8969-404d-9A6B-EE8AD0BC1CD0}处理出库审批并发的问题
                    int resultApplyOut = this.itemManager.UpdateApplyOut(applyOut, true);
                    if (resultApplyOut == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("更新" + output.Item.Name + "出库申请信息时出错");
                        return;
                    }
                    if (resultApplyOut == 0)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("该" + output.Item.Name + "申请信息已改变,请重新获取申请信息");
                        return;
                    }
                }
                else
                {
                    #region 无申请记录 此时只需更改申请人 到底需不需要添加申请信息呢? 不需要

                    output.Operation.ApplyOper = output.Operation.Oper;     //申请人
                    output.Operation.ApplyQty  = output.Quantity;           //申请数量

                    #endregion
                }

                #endregion

                #region 获取单据号

                if (outListNO == "")
                {
                    // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                    outListNO = phaIntegrate.GetInOutListNO(this.phaOutManager.DeptInfo.ID, false);
                    if (outListNO == null)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("获取新出库单号出错" + phaIntegrate.Err);
                        return;
                    }
                }

                output.OutListNO = outListNO;

                #endregion

                #region 以下信息在每次添加新数据时自动生成

                output.PrivType   = this.phaOutManager.PrivType.ID;             //出库类型
                output.SystemType = this.phaOutManager.PrivType.Memo;           //系统类型
                output.StockDept  = this.phaOutManager.DeptInfo;                //当前科室
                output.TargetDept = this.phaOutManager.TargetDept;              //目标科室

                #endregion

                //非药柜科室向药柜出库 进行特殊处理
                if (!this.phaOutManager.IsStockArk && this.phaOutManager.IsTargetArk)
                {
                    if (this.itemManager.ArkOutput(output, this.phaOutManager.IsStockArk, this.phaOutManager.IsTargetArk, false, true) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("出库保存发生错误" + this.itemManager.Err);
                        return;
                    }
                }
                else
                {
                    if (this.itemManager.Output(output, null, false) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Function.ShowMsg("出库保存发生错误" + this.itemManager.Err);
                        return;
                    }
                }

                this.alPrintData.Add(output);
            }

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

            Function.ShowMsg("保存成功");

            DialogResult rsPrint = MessageBox.Show(Language.Msg("是否打印出库单?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rsPrint == DialogResult.Yes)
            {
                this.Print();
            }

            this.Clear();
        }
Пример #27
0
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            #region 判断是否选择了核准数据

            bool isHaveCheck   = false;
            bool isHaveUnCheck = false;
            foreach (DataRow dr in this.dt.Rows)
            {
                if (NConvert.ToBoolean(dr["核准"]))
                {
                    isHaveCheck = true;
                }
                else
                {
                    isHaveUnCheck = true;
                }
            }

            if (!isHaveCheck)
            {
                MessageBox.Show(Language.Msg("请选择需核准数据"));
                return;
            }
            if (isHaveUnCheck)
            {
                DialogResult rs = MessageBox.Show(Language.Msg("存在未选择数据 确认对这些药品不进行核准吗?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                if (rs == DialogResult.No)
                {
                    return;
                }
            }

            #endregion

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

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();

            //Neusoft.FrameWork.Management.Transaction t = new Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            //phaIntegrate.SetTrans(t.Trans);

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            string inListNO = "";

            foreach (DataRow dr in this.dt.Rows)
            {
                if (!NConvert.ToBoolean(dr["核准"]))
                {
                    continue;
                }

                string key = this.GetKey(dr);

                //{7F9E7287-5803-4b42-9CFD-61A17FF1A5D4}  由Hash表获取数据时需调用Clone函数
                Neusoft.HISFC.Models.Pharmacy.Input input = (this.hsInData[key] as Neusoft.HISFC.Models.Pharmacy.Input).Clone();

                input.Operation.ApproveOper.OperTime = sysTime;                       //核准日期
                input.Operation.ApproveOper.ID       = this.phaInManager.OperInfo.ID; //核准人
                input.Operation.Oper = input.Operation.ApproveOper;

                if (input.ID == "" || input.InListNO == "" || input.GroupNO == 0)
                {
                    #region 药房入库核准时 无入库记录

                    if (inListNO == "" && (input.InListNO == "" || input.InListNO == null))
                    {
                        #region 获取新入库单号

                        if (input.OutListNO != "")
                        {
                            inListNO = input.OutListNO;
                        }
                        else
                        {
                            // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                            inListNO = phaIntegrate.GetInOutListNO(this.phaInManager.DeptInfo.ID, true);
                            if (inListNO == null)
                            {
                                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                                MessageBox.Show(Language.Msg("获取最新入库单号出错" + itemManager.Err));
                                return;
                            }
                        }

                        input.InListNO = inListNO;
                        #endregion
                    }
                    else
                    {
                        input.InListNO = inListNO;
                    }

                    decimal storageQty = 0;
                    if (this.itemManager.GetStorageNum(this.phaInManager.DeptInfo.ID, input.Item.ID, out storageQty) == -1)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        MessageBox.Show(Language.Msg("获取库存数量时出错" + this.itemManager.Err));
                        return;
                    }

                    input.StoreQty  = storageQty + input.Quantity;
                    input.StoreCost = input.StoreQty / input.Item.PackQty * input.Item.PriceCollection.RetailPrice;

                    input.Operation.ApplyOper = input.Operation.ApproveOper.Clone();
                    #endregion
                }

                if (this.isApproveEdit)
                {
                    input.InvoiceNO = dr["发票号"].ToString().Trim();
                    input.Item.PriceCollection.PurchasePrice = NConvert.ToDecimal(dr["购入价"]);
                }

                input.StockDept.Memo = this.phaInManager.DeptInfo.Memo;         //保存科室类别 PI药库 P药房

                //更新库存标记 对药库不进行更新 对药房更新库存
                if (this.itemManager.ApproveInput(input, input.StockDept.Memo == "PI"?"0":"1") == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(Language.Msg("保存 " + dr["商品名称"].ToString() + " 时发生错误") + this.itemManager.Err);
                    return;
                }
            }

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

            MessageBox.Show(Language.Msg("保存成功"));

            this.Clear();

            this.ShowSelectData();
        }
Пример #28
0
        /// <summary>
        /// 保存
        /// </summary>
        public virtual void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在进行保存操作..请稍候");
            System.Windows.Forms.Application.DoEvents();

            #region 事务定义

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

            Neusoft.HISFC.BizProcess.Integrate.Pharmacy phaIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy();
            Neusoft.HISFC.BizLogic.Pharmacy.Item        itemManager  = new Neusoft.HISFC.BizLogic.Pharmacy.Item();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            //itemManager.SetTrans(t.Trans);
            //phaIntegrate.SetTrans(t.Trans);

            #endregion

            //当天操作日期
            DateTime sysTime = itemManager.GetDateTimeFromSysDateTime();
            //入库单据号
            string inListNO = null;

            Neusoft.HISFC.Models.Pharmacy.Input input = new Neusoft.HISFC.Models.Pharmacy.Input();
            foreach (DataRow dr in this.dt.Rows)
            {
                string key = dr["药品编码"].ToString() + dr["批号"].ToString();

                input = this.hsInputData[key] as Neusoft.HISFC.Models.Pharmacy.Input;

                if (inListNO == null)
                {
                    inListNO = input.InListNO;
                }

                #region 如果不存在入库单据号 则获取新入库单据号

                if (inListNO == "" || inListNO == null)
                {
                    // //{59C9BD46-05E6-43f6-82F3-C0E3B53155CB} 更改入库单号获取方式
                    inListNO = phaIntegrate.GetInOutListNO(this.phaInManager.DeptInfo.ID, true);
                    if (inListNO == null)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        this.ShowMsg("获取最新入库单号出错" + itemManager.Err);
                        return;
                    }
                }

                #endregion

                input.InListNO = inListNO;                                          //入库单据号

                #region 以下信息在每次添加数据生成入库信息实体时赋值

                input.StockDept  = this.phaInManager.DeptInfo;                      //库存科室
                input.PrivType   = this.phaInManager.PrivType.ID;                   //用户类型
                input.SystemType = this.phaInManager.PrivType.Memo;                 //系统类型
                input.Company    = this.phaInManager.TargetDept;                    //供货单位
                input.TargetDept = this.phaInManager.TargetDept;                    //目标单位 = 供货单位

                #endregion

                if (input.Operation.ApplyOper.ID == "")
                {
                    input.Operation.ApplyQty           = input.Quantity;                //入库申请量
                    input.Operation.ApplyOper.ID       = this.phaInManager.OperInfo.ID;
                    input.Operation.ApplyOper.OperTime = sysTime;
                }

                input.Operation.Oper.ID       = this.phaInManager.OperInfo.ID;
                input.Operation.Oper.OperTime = sysTime;
                input.Operation.ApplyQty      = input.Quantity;                     //入库申请量

                input.State = "0";

                if (itemManager.SetApplyIn(input) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    this.ShowMsg("入库 保存失败" + itemManager.Err);
                    return;
                }
            }

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

            this.ShowMsg("外部入库申请保存成功");

            this.Clear();
        }