/// <summary>
        /// 修改数据
        /// </summary>
        public void Modify()
        {
            if (this.fpMaterialQuery_Sheet1.Rows.Count == 0)
            {
                return;
            }

            DataRow findRow;

            MaterialItem myItem = null;

            myItem = this.materialManager.GetMetItemByMetID(this.fpMaterialQuery_Sheet1.Cells[this.fpMaterialQuery_Sheet1.ActiveRowIndex, this.dv.Table.Columns.IndexOf("物品编码")].Value.ToString());

            this.ShowMaintenanceForm("U", myItem, true);

            findRow = dv.Table.Rows.Find(myItem.ID.ToString());

            if (findRow != null)
            {
                //根据编码取全部信息并显示在列表中
                myItem = materialManager.GetMetItemByMetID(myItem.ID.ToString());
                this.SetRow(findRow, myItem);
            }
            this.SetColor();
        }
Beispiel #2
0
        /// <summary>
        /// 模版选择
        /// </summary>
        /// <param name="privDept">权限科室</param>
        /// <param name="openType">模版类型</param>
        /// <returns>成功返回模版信息  失败返回null</returns>

        /*
         * internal static ArrayList ChooseDrugStencil(string privDept, Neusoft.HISFC.Models.Pharmacy.EnumDrugStencil stencilType)
         * {
         *  Neusoft.HISFC.BizLogic.Pharmacy.Constant consManager = new Neusoft.HISFC.BizLogic.Pharmacy.Constant();
         *
         *  ArrayList alList = consManager.QueryDrugStencilList(privDept, stencilType);
         *  if (alList == null)
         *  {
         *      System.Windows.Forms.MessageBox.Show(Language.Msg("获取该类型模版发生错误" + consManager.Err));
         *      return null;
         *  }
         *  if (alList.Count == 0)
         *  {
         *      System.Windows.Forms.MessageBox.Show(Language.Msg("无该类型模版数据"));
         *      return null;
         *  }
         *
         *  ArrayList alSelect = new ArrayList();
         *  Neusoft.FrameWork.Models.NeuObject selectObj = new Neusoft.FrameWork.Models.NeuObject();
         *  foreach (Neusoft.HISFC.Models.Pharmacy.DrugStencil temp in alList)
         *  {
         *      selectObj = new Neusoft.FrameWork.Models.NeuObject();
         *      selectObj.ID = temp.Stencil.ID;
         *      selectObj.Name = temp.Stencil.Name;
         *      selectObj.Memo = temp.OpenType.Name;
         *
         *      alSelect.Add(selectObj);
         *  }
         *
         *  string[] label = { "模版编码", "模版名称", "模版类型" };
         *  float[] width = { 60F, 100F, 120F };
         *  bool[] visible = { true, true, true, false, false, false };
         *  if (Neusoft.FrameWork.WinForms.Classes.Function.ChooseItem(alSelect, ref selectObj) == 0)
         *  {
         *      return new ArrayList();
         *  }
         *  else
         *  {
         *      ArrayList alOpenDetail = new ArrayList();
         *
         *      alOpenDetail = consManager.QueryDrugStencil(selectObj.ID);
         *      if (alOpenDetail == null)
         *      {
         *          System.Windows.Forms.MessageBox.Show(Language.Msg(consManager.Err));
         *          return null;
         *      }
         *
         *      return alOpenDetail;
         *  }
         * }
         */
        /// <summary>
        /// 获取提示信息
        /// </summary>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static string GetNote(string itemCode)
        {
            Neusoft.HISFC.BizLogic.Material.MetItem myItem = new Neusoft.HISFC.BizLogic.Material.MetItem();

            Neusoft.HISFC.BizLogic.Material.ComCompany myCom = new Neusoft.HISFC.BizLogic.Material.ComCompany();

            Neusoft.HISFC.Models.Material.MaterialItem item = myItem.GetMetItemByMetID(itemCode);

            Neusoft.HISFC.Models.Material.MaterialCompany company = myCom.QueryCompanyByCompanyID(item.Company.ID, "A", "A");

            DateTime dtNow = myItem.GetDateTimeFromSysDateTime();

            string note = "";

            if (company != null)
            {
                if (company.BusinessDate < dtNow)
                {
                    note += "营业执照已经到期!" + "\n";
                }
                if (company.DutyDate < dtNow)
                {
                    note += "税务登记证已经到期!" + "\n";
                }
                if (company.OrgDate < dtNow)
                {
                    note += "组织机构代码证已经到期!" + "\n";
                }
            }

            return(note);
        }
        /// <summary>
        /// 根据物品编码加入 入库申请数据{3F8F98B1-44E9-4828-90C4-0931F6DA7B87}
        /// </summary>
        /// <param name="drugNO">物品编码</param>
        /// <param name="outBillNO">出库序号</param>
        /// <returns></returns>
        private int AddDrugData(string drugNO, string outBillNO, decimal applyPrice)
        {
            Neusoft.HISFC.Models.Material.MaterialItem item = itemManager.GetMetItemByMetID(drugNO);

            if (item == null)
            {
                System.Windows.Forms.MessageBox.Show("检索物品基本信息失败");
                return(-1);
            }

            Neusoft.HISFC.Models.Material.Apply apply = new Neusoft.HISFC.Models.Material.Apply();

            apply.Item = item;

            if (this.hsApplyData.Contains(apply.Item.ID))
            {
                System.Windows.Forms.MessageBox.Show("该物品已添加");
                return(0);
            }

            if (outBillNO != null)
            {
                apply.ApplyListNO = outBillNO;
            }

            apply.StockDept  = this.MatApplyManager.DeptInfo;    //库存科室 (目标科室)
            apply.TargetDept = this.MatApplyManager.TargetDept;  //申请科室
            apply.State      = "0";                              //状态 申请
            apply.SystemType = this.MatApplyManager.PrivType.Memo;
            apply.PrivType   = this.MatApplyManager.PrivType.ID;
            //内部入库申请的申请价格应该是零售价 而不是物资目录中的单价 by yuyun {3F8F98B1-44E9-4828-90C4-0931F6DA7B87}
            apply.ApplyPrice = applyPrice;

            if (this.AddDataToTable(apply, "1") == 1)
            {
                this.hsApplyData.Add(apply.Item.ID, apply);

                //				this.SetFormat();

                this.SetFocusSelect();
            }

            return(1);
        }
        /// <summary>
        /// 根据申请单信息向DataTable内增加数据
        /// </summary>
        /// <param name="apply">申请信息</param>
        /// <param name="dataSource">数据来源 0 原始数据 1 本次添加</param>
        /// <returns></returns>
        protected virtual int AddApplyToTable(Neusoft.HISFC.Models.Material.Apply apply, string dataSource)
        {
            if (this.dt == null)
            {
                this.InitDataTable();
            }

            try
            {
                Neusoft.HISFC.BizLogic.Material.MetItem managerItem = new Neusoft.HISFC.BizLogic.Material.MetItem();
                apply.Item = managerItem.GetMetItemByMetID(apply.Item.ID);

                decimal price = 0;
                decimal qty   = 0;
                decimal cost  = 0;
                string  unit  = "";

                if (this.isMinUnit)
                {
                    qty   = apply.Operation.ApplyQty;
                    cost  = apply.Operation.ApplyQty * apply.Item.UnitPrice;
                    unit  = apply.Item.MinUnit;
                    price = apply.Item.UnitPrice;
                }
                else
                {
                    qty   = apply.Operation.ApplyQty / apply.Item.PackQty;
                    cost  = apply.Operation.ApplyQty / apply.Item.PackQty * apply.Item.PackPrice;
                    unit  = apply.Item.PackUnit;
                    price = apply.Item.PackPrice;
                }
                this.dt.Rows.Add(new object[] {
                    apply.Item.Name,                                                                                                             //商品名称
                    apply.Item.Specs,                                                                                                            //规格
                    price,                                                                                                                       //零售价
                    unit,                                                                                                                        //包装单位
                    qty,                                                                                                                         //申请数量
                    cost,                                                                                                                        //申请金额
                    apply.Memo,                                                                                                                  //备注
                    apply.Item.ID,                                                                                                               //物品编码
                    apply.SerialNO,                                                                                                              //序号
                    dataSource,
                    apply.Item.SpellCode,                                                                                                        //拼音码
                    apply.Item.WBCode,                                                                                                           //五笔码
                    apply.Item.UserCode                                                                                                          //自定义码
                }
                                 );

                this.dt.DefaultView.AllowDelete = true;
                this.dt.DefaultView.AllowEdit   = true;
                this.dt.DefaultView.AllowNew    = true;
            }
            catch (System.Data.DataException e)
            {
                System.Windows.Forms.MessageBox.Show("DataTable内赋值发生错误" + e.Message);

                return(-1);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("DataTable内赋值发生错误" + ex.Message);

                return(-1);
            }

            return(1);
        }