Пример #1
0
        /// <summary>
        /// 制剂成品消耗信息获取
        /// </summary>
        /// <param name="preparation">制剂成品消耗信息</param>
        /// <returns>成功返回制剂成品消耗信息 失败返回null</returns>
        internal List <Neusoft.HISFC.Models.Preparation.Expand> QueryExpandList(Neusoft.HISFC.Models.Preparation.Preparation preparation)
        {
            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = this.preparationManager.QueryExpand(preparation, this.stockDept);

            if (expandList == null)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("获取制剂消耗信息发生错误") + this.preparationManager.Err);
                return(null);
            }
            else if (expandList.Count == 0)
            {
                expandList = this.ComputePrescription(preparation);
            }
            else
            {
                foreach (Neusoft.HISFC.Models.Preparation.Expand expand in expandList)
                {
                    if (expand.PlanQty == preparation.PlanQty)
                    {
                        continue;
                    }
                    else
                    {
                        expand.PlanQty       = preparation.PlanQty;
                        expand.PlanExpand    = preparation.PlanQty * expand.Prescription.NormativeQty;
                        expand.FacutalExpand = -1;
                    }
                }
            }

            return(expandList);
        }
Пример #2
0
        private Dictionary <string, string> ComputeCostPrice(PManager pManager, ref PObject.Preparation preparation)
        {
            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = ucExpand.QueryExpandList(pManager, preparation);

            if (expandList == null)
            {
                return(null);
            }

            decimal costPrice = 0;

            foreach (Neusoft.HISFC.Models.Preparation.Expand info in expandList)
            {
                costPrice = info.FacutalExpand / info.Prescription.MaterialPackQty * info.Prescription.Price;
                this.drugNameDict.Add("[" + info.Prescription.Material.ID + "]", costPrice.ToString());
            }
            if (costPrice == 0)
            {
                preparation.CostPrice = preparation.Drug.PriceCollection.PurchasePrice;
            }
            else
            {
                preparation.CostPrice = costPrice;
            }
            return(drugNameDict);
        }
Пример #3
0
        /// <summary>
        /// 复制对象
        /// </summary>
        /// <returns>Preparation</returns>
        public new Preparation Clone()
        {
            Preparation preparation = base.Clone() as Preparation;

            preparation.inputEnv   = this.inputEnv.Clone();
            preparation.planEnv    = this.planEnv.Clone();
            preparation.confectEnv = this.confectEnv.Clone();
            preparation.assayEnv   = this.assayEnv.Clone();
            return(preparation);
        }
Пример #4
0
        /// <summary>
        /// 制剂成品消耗信息显示
        /// </summary>
        /// <param name="preparation">制剂成品消耗信息集合</param>
        /// <returns>成功返回1 失败返回-1</returns>
        internal int ShowExpand(Neusoft.HISFC.Models.Preparation.Preparation preparation)
        {
            this.tabPage1.Text = preparation.Drug.Name + "[ " + preparation.Drug.Specs + " ] --  生产原料、辅料信息 - 修改消耗信息后请注意保存";

            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = this.QueryExpandList(preparation);

            if (expandList != null)
            {
                this.ShowExpand(expandList);
            }

            return(1);
        }
Пример #5
0
        /// <summary>
        /// 成本价计算
        /// </summary>
        /// <param name="preparation">制剂成品信息</param>
        /// <returns>成功返回1 失败返回-1</returns>
        internal static int ComputeCostPrice(PManager pManager, ref PObject.Preparation preparation, ComputeCostPriceType computeType)
        {
            if (computeType == ComputeCostPriceType.Manual)
            {
                using (ucCostPrice uc = new ucCostPrice( ))
                {
                    uc.SetPreparation(preparation, pManager, ref preparation);
                    Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text = "成本价设置";
                    Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(uc);
                    if (uc.Result == DialogResult.Cancel)
                    {
                        return(1);
                    }
                    else
                    {
                        preparation.CostPrice = uc.CostPrice;
                        return(1);
                    }
                }
            }
            else
            {
                List <Neusoft.HISFC.Models.Preparation.Expand> expandList = ucExpand.QueryExpandList(pManager, preparation);
                if (expandList == null)
                {
                    return(-1);
                }

                decimal costPrice = 0;

                foreach (Neusoft.HISFC.Models.Preparation.Expand info in expandList)
                {
                    costPrice = info.FacutalExpand / info.Prescription.MaterialPackQty * info.Prescription.Price;
                }
                if (costPrice == 0)
                {
                    preparation.CostPrice = preparation.Drug.PriceCollection.PurchasePrice;
                }
                else
                {
                    preparation.CostPrice = costPrice;
                }
            }

            return(1);
        }
Пример #6
0
        /// <summary>
        /// 制剂原料消耗信息计算
        /// </summary>
        /// <param name="info">制剂成品计划信息</param>
        internal List <Neusoft.HISFC.Models.Preparation.Expand> ComputePrescription(Neusoft.HISFC.Models.Preparation.Preparation info)
        {
            List <Neusoft.HISFC.Models.Preparation.Prescription> prescriptionList = this.preparationManager.QueryDrugPrescription(info.Drug.ID);

            if (prescriptionList == null)
            {
                MessageBox.Show(Language.Msg("获取制剂配制处方信息发生错误") + this.preparationManager.Err);
                return(null);
            }

            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = new List <Neusoft.HISFC.Models.Preparation.Expand>();

            foreach (Neusoft.HISFC.Models.Preparation.Prescription prescription in prescriptionList)
            {
                Neusoft.HISFC.Models.Preparation.Expand expand = new Neusoft.HISFC.Models.Preparation.Expand();

                expand.Prescription = prescription;
                expand.PlanNO       = info.PlanNO;
                expand.PlanQty      = info.PlanQty;
                expand.PlanExpand   = info.PlanQty * prescription.NormativeQty;

                expand.FacutalExpand = -1;

                //{8840008D-2FEA-4471-B404-B05E25832120}  获取库存
                decimal storeQty = 0;
                if (this.pharmacyIntegrate.GetStorageNum(this.stockDept.ID, expand.Prescription.Material.ID, out storeQty) == -1)
                {
                    MessageBox.Show("加载原料库存发生错误" + this.pharmacyIntegrate.Err);
                    return(null);
                }
                expand.StoreQty = storeQty;
                //{8840008D-2FEA-4471-B404-B05E25832120}  获取库存

                expandList.Add(expand);
            }

            return(expandList);
        }
Пример #7
0
        /// <summary>
        /// 有效性检查
        /// </summary>
        /// <param name="preparation">制剂主信息</param>
        /// <param name="isNotice">是否进行信息提示</param>
        /// <returns>库存条件满足或自动形成申请信息 True 库存不足或不自动形成申请 False</returns>
        internal bool ValidStock(Neusoft.HISFC.Models.Preparation.Preparation preparation, bool isNotice)
        {
            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = this.QueryExpandList(preparation);

            if (expandList == null)
            {
                return(false);
            }
            foreach (Neusoft.HISFC.Models.Preparation.Expand expand in expandList)
            {
                if (expand.StoreQty < expand.FacutalExpand)
                {
                    if (isNotice)
                    {
                        DialogResult rs = MessageBox.Show(preparation.Drug.Name + Language.Msg("  原料库存不足,是否自动形成入库申请?"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (rs == DialogResult.No)      //不允许自动形成申请 数据无效
                        {
                            return(false);
                        }
                        else                           //允许自动形成申请 isAutoApply设置为True
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #8
0
        /// <summary>
        /// 设置制剂成品信息 并 显示成本计算公式、当前成本价
        /// </summary>
        /// <param name="preparation">制剂成品信息</param>
        protected int SetPreparation(Neusoft.HISFC.Models.Preparation.Preparation preparation, PManager pManager, ref PObject.Preparation preparation1)
        {
            string drugCode = preparation.Drug.ID;
            List <Neusoft.HISFC.Models.Preparation.Prescription> al = this.preparationManager.QueryDrugPrescription(drugCode);

            if (al == null)
            {
                return(-1);
            }
            foreach (Neusoft.HISFC.Models.Preparation.Prescription info in al)
            {
                drugCodeDict.Add(info.Material.ID, info.Material.Name);
                //drugNameDict.Add ( info.Material.Name, info.Material.ID );
            }

            string costPriceFormula = this.preparationManager.GetCostPriceFormula(drugCode);

            this.ntxtCostPrice.Text = Neusoft.FrameWork.Public.String.ExpressionVal(this.CodeToPrice(costPriceFormula, this.ComputeCostPrice(pManager, ref preparation1))).ToString();
            costPriceFormula        = this.CodeToName(costPriceFormula);
            this.costPriceTxt.Text  = costPriceFormula;
            this.lbPreparation.Text = string.Format(this.strPreparation, preparation.Drug.Name, preparation.Drug.Specs, preparation.BatchNO, preparation.PlanQty, preparation.Unit);

            return(this.ucExpand1.ShowExpand(preparation));
        }
Пример #9
0
        /// <summary>
        /// 制剂消耗信息获取
        /// </summary>
        /// <param name="preparationManager">制剂管理业务层</param>
        /// <param name="preparation">制剂成品信息</param>
        /// <returns>成功返回制剂消耗信息 失败返回null</returns>
        internal static List <PObject.Expand> QueryExpandList(PManager preparationManager, PObject.Preparation preparation)
        {
            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = preparationManager.QueryExpand(preparation, null);

            if (expandList == null)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("获取制剂消耗信息发生错误") + preparationManager.Err);
                return(null);
            }

            return(expandList);
        }
Пример #10
0
        /// <summary>
        /// 消耗信息保存
        /// </summary>
        /// <param name="info">制剂主信息</param>
        /// <param name="isExecApplyData">是否用于生成原材料申请信息</param>
        /// <param name="Err">错误提示</param>
        /// <returns></returns>
        internal int SaveExpandForStock(Neusoft.HISFC.Models.Preparation.Preparation preparation, bool isExecApplyData, ref string Err)
        {
            Err = "";
            bool isLocalTrans = false;

            if (Neusoft.FrameWork.Management.PublicTrans.Trans == null)
            {
                Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
                isLocalTrans = true;
            }

            this.pharmacyIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            this.preparationManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.preparationManager.GetDateTimeFromSysDateTime();

            List <Neusoft.HISFC.Models.Preparation.Expand> expandList = this.preparationManager.QueryExpand(preparation, this.stockDept);

            if (expandList == null)
            {
                if (isLocalTrans)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                }
                Err = Neusoft.FrameWork.Management.Language.Msg("获取制剂消耗信息发生错误") + this.preparationManager.Err;
                return(-1);
            }

            foreach (Neusoft.HISFC.Models.Preparation.Expand info in expandList)
            {
                info.Prescription.OperEnv.OperTime = sysTime;
                info.Prescription.OperEnv.ID       = this.preparationManager.Operator.ID;
                info.PlanNO = preparation.PlanNO;

                if (isExecApplyData)
                {
                    #region 申请信息生成

                    if (info.StoreQty < info.FacutalExpand)
                    {
                        if (info.Prescription.MaterialType == Neusoft.HISFC.Models.Preparation.EnumMaterialType.Material)     //药品
                        {
                            //{64FAE14C-7D1B-42ea-B19D-2C1B3846D2D0} 申请信息自动生成时 重新获取项目信息
                            Neusoft.HISFC.Models.Pharmacy.Item tempItem = this.pharmacyIntegrate.GetItem(info.Prescription.Material.ID);
                            if (tempItem == null)
                            {
                                if (isLocalTrans)
                                {
                                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                                }
                                Err = Language.Msg("根据药品原料编码获取原材料信息失败! ") + this.pharmacyIntegrate.Err;
                                return(-1);
                            }
                            if (this.pharmacyIntegrate.ProduceApply(tempItem, info, this.stockDept, this.materialStockDept) == -1)
                            {
                                if (isLocalTrans)
                                {
                                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                                }
                                Err = Language.Msg("根据库存及原料消耗生成申请信息发生错误" + this.pharmacyIntegrate.Err);
                                return(-1);
                            }
                        }
                        else
                        {
                            if (this.MaterialInterface != null)
                            {
                                if (this.MaterialInterface.Apply(info.Prescription.Material, info, stockDept, Neusoft.FrameWork.Management.PublicTrans.Trans) == -1)
                                {
                                    if (isLocalTrans)
                                    {
                                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                                    }
                                    Err = Language.Msg("通过接口进行原料申请时发生错误") + this.preparationManager.Err;
                                    return(-1);
                                }
                            }
                        }
                    }

                    #endregion

                    info.ExecOutput = false;
                }
                else
                {
                    #region 库存扣除

                    //生产原料扣库
                    if (info.Prescription.MaterialType == Neusoft.HISFC.Models.Preparation.EnumMaterialType.Material)     //药品
                    {
                        Neusoft.HISFC.Models.Pharmacy.Item tempItem = this.pharmacyIntegrate.GetItem(info.Prescription.Material.ID);
                        if (tempItem == null)
                        {
                            if (isLocalTrans)
                            {
                                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            }
                            Err = Language.Msg("根据药品原料编码获取原材料信息失败! ") + this.pharmacyIntegrate.Err;
                            return(-1);
                        }
                        if (this.pharmacyIntegrate.ProduceOutput(tempItem, info, stockDept) == -1)
                        {
                            if (isLocalTrans)
                            {
                                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            }
                            Err = this.pharmacyIntegrate.Err;
                            return(-1);
                        }
                    }
                    else
                    {
                        if (this.MaterialInterface != null)
                        {
                            if (this.MaterialInterface.Output(info.Prescription.Material, info, stockDept, Neusoft.FrameWork.Management.PublicTrans.Trans) == -1)
                            {
                                if (isLocalTrans)
                                {
                                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                                }
                                Err = Language.Msg("通过接口进行原料库存扣除失败! ");
                                return(-1);
                            }
                        }
                    }
                    #endregion

                    info.ExecOutput = true;
                }

                if (this.preparationManager.SetExpand(info) == -1)
                {
                    if (isLocalTrans)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    }
                    Err = Language.Msg("保存消耗信息时发生错误") + this.preparationManager.Err;
                    return(-1);
                }
            }

            if (isLocalTrans)
            {
                Neusoft.FrameWork.Management.PublicTrans.Commit();
            }

            return(1);
        }