Example #1
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);
        }
Example #2
0
        /// <summary>
        /// 查询所有
        /// </summary>
        protected virtual void QueryAll()
        {
            this.FpMetItemAddRule_Sheet1.RowCount = 0;
            List <Neusoft.HISFC.Models.Material.MaterialItem> al = this.itemManager.QueryMetItemHaveAddRule();

            if (al != null && al.Count > 0)
            {
                for (int i = 0; i < al.Count; i++)
                {
                    Neusoft.HISFC.Models.Material.MaterialItem item = al[i] as Neusoft.HISFC.Models.Material.MaterialItem;
                    this.AddDataToFP(item, false);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 根据物品信息添加出库记录
        /// </summary>
        /// <param name="itemNO">物资项目编码</param>
        /// <param name="storageQty">库存数量</param>
        /// <returns></returns>
        protected virtual int AddDrugData(string itemNO, decimal storageQty, decimal price)
        {
            if (this.outManager.TargetDept.ID == "" || this.outManager.TargetDept.ID == "A")
            {
                MessageBox.Show("请选择领用单位!");
                return(0);
            }

            if (this.hsItemData.ContainsKey(itemNO + price.ToString()))
            {
                MessageBox.Show("该物品已添加");
                return(0);
            }

            Neusoft.HISFC.Models.Material.MaterialItem item = this.itemManager.GetMetItemByMetID(itemNO);
            if (item == null)
            {
                MessageBox.Show("根据编码获取物资字典信息时发生错误" + this.itemManager.Err);
                return(-1);
            }

            Neusoft.HISFC.Models.Material.Output output = new Neusoft.HISFC.Models.Material.Output();

            output.StoreBase.Item = item;                                                               //物品信息

            output.StoreBase.PrivType   = this.outManager.PrivType.ID;                                  //出库类型
            output.StoreBase.SystemType = this.outManager.PrivType.Memo;                                //系统类型
            output.StoreBase.StockDept  = this.outManager.DeptInfo;                                     //当前科室
            output.StoreBase.TargetDept = this.outManager.TargetDept;                                   //目标科室
            output.StoreBase.StoreQty   = storageQty;                                                   //库存量
            output.StoreBase.PriceCollection.PurchasePrice = price;
            output.StoreBase.PriceCollection.RetailPrice   = price;

            output.User01 = "0";                                                                                                                //数据来源
            output.User03 = output.StoreBase.Item.ID.ToString() + output.StoreBase.PriceCollection.RetailPrice.ToString();                      //设置主键

            if (this.AddDataToTable(output) == 1)
            {
                this.hsOutData.Add(output.User03, output);

                this.hsItemData.Add(output.User03, null);                                               //存储已添加的项目 防止重复添加
            }

            return(1);
        }
        /// <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);
        }
Example #5
0
        private void ucMaterialItemList1_ChooseDataEvent(FarPoint.Win.Spread.SheetView sv, int activeRow)
        {
            //by yuyun 08-7-28 第一列变成自定义码  原自定义码列成物资编码{7019A2A6-ADCA-4984-944B-C4F1A312449A}
            //string itemCode = sv.Cells[activeRow, 0].Text;
            string itemCode = sv.Cells[activeRow, 10].Text;

            Neusoft.HISFC.Models.Material.MaterialItem item = this.itemManager.GetMetItemByMetID(itemCode);
            for (int i = 0; i < this.FpMetItemAddRule_Sheet1.RowCount; i++)
            {
                if (item.ID == this.FpMetItemAddRule_Sheet1.Cells[i, 0].Text)
                {
                    this.FpMetItemAddRule.Focus();
                    this.FpMetItemAddRule_Sheet1.ActiveRowIndex = i;

                    return;
                }
            }
            this.AddDataToFP(item, true);
        }
        /// <summary>
        /// 根据物品编码加入 入库申请数据 --退库申请用
        /// </summary>
        /// <param name="itemCode">物品编码</param>
        /// <param name="outNo">出库流水号</param>
        /// <param name="storeNo">库存序号</param>
        /// <returns></returns>
        private int AddDrugData(string itemCode, string outNo, string storeNo)
        {
            Neusoft.HISFC.Models.Material.MaterialItem item = itemManager.GetMetItemByMetID(itemCode);

            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);
            }
            apply.OutNo   = outNo;
            apply.StockNO = storeNo;
            //获取对应批号库存信息中的零售价{3F8F98B1-44E9-4828-90C4-0931F6DA7B87}
            List <Neusoft.HISFC.Models.Material.StoreDetail> listStoreBase = this.storeManager.QueryStoreListAll(this.MatApplyManager.TargetDept.ID, itemCode, storeNo, true);

            apply.ApplyPrice = listStoreBase[0].StoreBase.PriceCollection.RetailPrice;
            //----------------------
            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;

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

                //				this.SetFormat();

                this.SetFocusSelect();
            }

            return(1);
        }
Example #7
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            //检查数据有效性
            if (!this.IsValid())
            {
                return;
            }

            //保存
            if (this.Save() == -1)
            {
                return;
            }


            switch (this.InputType)
            {
            case "U":
                this.InputType = "N";
                this.FindForm().Close();
                break;

            case "I":

                this.Reset();

                if (this.continueCheckBox.Checked)
                {
                    //						this.MyInput(this.Item);
                    this.InputType = "I";
                    this.Item      = this.originalItem;
                    //{311DF45B-025A-4fac-A8FD-1B74AFFE4933}
                    this.txtName.Focus();
                }
                else
                {
                    this.InputType = "N";
                    this.FindForm().Close();
                }
                break;
            }
        }
Example #8
0
        /// <summary>
        /// 清空控件
        /// </summary>
        public void Reset()
        {
            foreach (System.Windows.Forms.Control c in this.Controls)
            {
                if (c.GetType() == typeof(System.Windows.Forms.GroupBox))
                {
                    foreach (System.Windows.Forms.Control crl in c.Controls)
                    {
                        if (crl.GetType() == typeof(Neusoft.FrameWork.WinForms.Controls.NeuComboBox))
                        {
                            continue;
                        }
                        if (crl.GetType() != typeof(System.Windows.Forms.Label) && crl.GetType() != typeof(System.Windows.Forms.CheckBox))
                        {
                            crl.Tag  = "";
                            crl.Text = "";
                        }
                    }
                }
            }

            foreach (System.Windows.Forms.Control c in this.Controls)
            {
                if (c.GetType() == typeof(System.Windows.Forms.GroupBox))
                {
                    foreach (System.Windows.Forms.Control crl in c.Controls)
                    {
                        if (crl.GetType() != typeof(System.Windows.Forms.Label) && crl.GetType() != typeof(System.Windows.Forms.CheckBox))
                        {
                            crl.Tag  = "";
                            crl.Text = "";
                        }
                    }
                }
            }

            this.item = null;
            //this.cmbKind.Tag = this.item.MaterialKind.ID;

            this.ckFinance.Checked = false;
            this.ckStop.Checked    = false;
        }
Example #9
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns>成功返回1 发生错误返回-1</returns>
        public int Init()
        {
            Neusoft.HISFC.BizLogic.Manager.Department deptMgr = new Neusoft.HISFC.BizLogic.Manager.Department();
            ArrayList al = deptMgr.GetDeptmentAll();

            if (al == null)
            {
                MessageBox.Show("获取库房列表发生错误" + deptMgr.Err);
                return(-1);
            }
            ArrayList alDept = new ArrayList();

            foreach (Neusoft.HISFC.Models.Base.Department info in al)
            {
                if (info.DeptType.ID.ToString() == "P" || info.DeptType.ID.ToString() == "PI")
                {
                    alDept.Add(info);
                }
            }

            Neusoft.FrameWork.Models.NeuObject deptAll = new Neusoft.FrameWork.Models.NeuObject();
            deptAll.ID   = "AAAA";
            deptAll.Name = "全部";
            alDept.Insert(0, deptAll);

            this.cmbDept.AddItems(alDept);
            this.deptHelper = new Neusoft.FrameWork.Public.ObjectHelper(alDept);

            Neusoft.HISFC.BizLogic.Material.MetItem    itemManager = new Neusoft.HISFC.BizLogic.Material.MetItem();
            Neusoft.HISFC.Models.Material.MaterialItem listItem    = itemManager.GetMetItemByValid("1");
            if (listItem == null)
            {
                MessageBox.Show("获取物品列表发生错误" + itemManager.Err);
                return(-1);
            }
            ArrayList alItem = new ArrayList();

            alItem.Add(listItem);
            this.cmbItem.AddItems(alItem);
            this.itemHelper = new Neusoft.FrameWork.Public.ObjectHelper(alItem);
            return(1);
        }
Example #10
0
        /// <summary>
        /// 添加数据到表格
        /// </summary>
        /// <param name="item"></param>
        protected virtual void AddDataToFP(Neusoft.HISFC.Models.Material.MaterialItem item, bool isNew)
        {
            int rowCount = this.FpMetItemAddRule_Sheet1.RowCount;

            this.FpMetItemAddRule_Sheet1.Rows.Add(rowCount, 1);

            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 0].Text = item.ID;
            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 1].Text = item.Name;
            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 2].Text = item.Specs;
            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 3].Text = item.UnitPrice.ToString();
            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 4].Text = item.MinUnit;
            this.FpMetItemAddRule_Sheet1.Cells[rowCount, 5].Text = this.helper.GetName(item.AddRule);

            if (isNew)
            {
                this.FpMetItemAddRule_Sheet1.Cells[rowCount, 8].Text = "ADD";
            }

            this.FpMetItemAddRule_Sheet1.Rows[rowCount].Tag = item;
        }
Example #11
0
 /// <summary>
 /// 将该物品设置为无效状态:更新log_mat_stock和log_mat_stockinfo的有效标志字段
 /// </summary>
 /// <param name="matItem">物资项目实体</param>
 /// <returns>1:成功;-1:失败</returns>
 private int SetMatVaild(Neusoft.HISFC.Models.Material.MaterialItem matItem, out string errMsg)
 {
     errMsg = "";
     Neusoft.HISFC.Models.Material.MaterialItem oldMatItem = this.magageMetItem.GetMetItemByMetID(matItem.ID);
     if (oldMatItem == null)
     {
         errMsg = "获取原物资信息失败" + this.magageMetItem.Err;
         return(-1);
     }
     if ((oldMatItem.ValidState && matItem.ValidState) || (!oldMatItem.ValidState && !matItem.ValidState))
     {
         return(1);
     }
     if (this.storeManager.SetMatVaild(matItem.ID, matItem.ValidState) == -1)
     {
         errMsg = "更改库存物资有效状态失败" + this.storeManager.Err;
         return(-1);
     }
     return(1);
 }
Example #12
0
        /// <summary>
        /// 根据物品编码加入 入库申请数据 --退库申请用
        /// </summary>
        /// <param name="itemCode">物品编码</param>
        /// <param name="outNo">出库流水号</param>
        /// <param name="storeNo">库存序号</param>
        /// <returns></returns>
        private int AddDrugData(string itemCode, string outNo, string storeNo)
        {
            Neusoft.HISFC.Models.Material.MaterialItem item = itemManager.GetMetItemByMetID(itemCode);

            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);
            }
            apply.OutNo   = outNo;
            apply.StockNO = storeNo;

            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;

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

                //				this.SetFormat();

                this.SetFocusSelect();
            }

            return(1);
        }
Example #13
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <returns>成功: 返回1,失败: 返回 -1</returns>
        public int Save()
        {
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

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

            magageMetItem.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            int parm = 1;

            Neusoft.HISFC.Models.Material.MaterialItem matItem = new Neusoft.HISFC.Models.Material.MaterialItem();

            matItem = this.Item;

            #region 处理将物资有效性状态
            if (this.InputType == "U")
            {
                this.storeManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
                string errMsg = "";

                if (this.SetMatVaild(matItem, out errMsg) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(errMsg);
                    return(-1);
                }
            }
            #endregion

            switch (this.InputType)
            {
            case "U":
                parm = magageMetItem.UpdateMetItem(matItem);
                break;

            case "I":
                matItem.ID = magageMetItem.GetMaxItemID(this.cmbKind.Tag.ToString());
                parm       = magageMetItem.InsertMetItem(matItem);
                break;

            case "N":
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                return(-1);
            }

            if (parm == -1)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                MessageBox.Show(this.magageMetItem.Err);
                return(-1);
            }
            else
            {
                Neusoft.FrameWork.Management.PublicTrans.Commit();

                if (this.inputType == "I")
                {
                    this.MyInput(matItem);
                }

                MessageBox.Show("保存成功!", "提示");

                return(1);
            }
        }
Example #14
0
        /// <summary>
        /// 从控件中取数据,赋予item实体
        /// </summary>
        private void GetItem()
        {
            Neusoft.FrameWork.Management.DataBaseManger data = new Neusoft.FrameWork.Management.DataBaseManger();

            string operCode = ((Neusoft.HISFC.Models.Base.Employee)data.Operator).ID;

            if (this.item == null)
            {
                this.item = new Neusoft.HISFC.Models.Material.MaterialItem();
            }

            this.item.ID = this.txtItemId.Text;

            //if (this.inputType == "I")
            //{
            //    Neusoft.HISFC.BizLogic.Material.MetItem item = new Neusoft.HISFC.BizLogic.Material.MetItem();

            //    try
            //    {
            //        this.item.ID = item.GetMaxItemID(this.cmbKind.Tag.ToString());
            //        this.txtItemId.Text = this.item.ID;
            //    }
            //    catch { }
            //}
            this.item.Name            = this.txtName.Text;
            this.item.SpellCode       = this.txtSpellCode.Text;
            this.item.WBCode          = this.txtWbCode.Text;
            this.item.UserCode        = this.txtUserCode.Text;
            this.item.GbCode          = this.txtGbCode.Text;
            this.item.MaterialKind.ID = this.cmbKind.Tag.ToString();
            this.item.Specs           = this.txtSpec.Text;
            this.item.MinUnit         = this.cmbUnit.Text.ToString();
            this.item.UnitPrice       = NConvert.ToDecimal(txtPrice.Text);
            this.item.ApproveInfo     = this.txtApprove.Text;
            if (this.cmbMet.Tag != null)
            {
                this.item.Compare.ID   = this.cmbMet.Tag.ToString();
                this.item.Compare.Name = this.cmbMet.Text;
            }
            if (this.cmbUnDrug.Tag != null)
            {
                if (this.cmbUnDrug.Tag.ToString() == "None")
                {
                    this.item.UndrugInfo.ID   = "";
                    this.item.UndrugInfo.Name = "";
                }
                else
                {
                    this.item.UndrugInfo.ID   = this.cmbUnDrug.Tag.ToString();
                    this.item.UndrugInfo.Name = this.cmbUnDrug.Text;
                }
            }
            this.item.ValidState  = !this.ckStop.Checked;
            this.item.SpecialFlag = Neusoft.FrameWork.Function.NConvert.ToInt32(this.ckSpecial.Checked).ToString();

            this.item.Factory.ID     = this.cmbFactory.Tag.ToString();
            this.item.Company.ID     = this.cmbCompany.Tag.ToString();
            this.item.MinFee.ID      = this.cmbFeeKind.Tag.ToString();
            this.item.StatInfo.ID    = this.cmbStatCode.Tag.ToString();
            this.item.InSource       = this.txtSource.Text;
            this.item.Usage          = this.txtUse.Text;
            this.item.PackUnit       = this.cmbPackUnit.Text.ToString();
            this.item.PackQty        = NConvert.ToDecimal(txtPackNum.Text);
            this.item.PackPrice      = this.item.UnitPrice * this.item.PackQty;
            this.item.StorageInfo.ID = this.txtStorage.Text;
            this.item.Oper.ID        = operCode;
            this.item.OperTime       = Convert.ToDateTime(DateTime.Now.ToString("f"));
            this.item.FinanceState   = this.ckFinance.Checked;
            this.item.Mader          = this.txtMader.Text;
            this.item.ZCH            = this.txtZCH.Text;
            this.item.SpeType        = this.cmbSpeType.Text;
            this.item.ZCDate         = this.dtZC.Value;
            this.item.OverDate       = this.dtOver.Value;
        }
Example #15
0
        /// <summary>
        /// 增加申请数据
        /// </summary>
        /// <param name="listCode">申请单号</param>
        /// <param name="state">状态</param>
        /// <returns>成功返回1 </失败返回-1returns>
        protected virtual int AddApplyData(string listCode, string deptCode, string state)
        {
            //this.Clear();

            ArrayList alDetail = new ArrayList();

            alDetail = this.storeManager.QueryApplyDetailByListNO(deptCode, listCode, state);

            if (alDetail == null)
            {
                MessageBox.Show(this.storeManager.Err);
                return(-1);
            }

            ((System.ComponentModel.ISupportInitialize)(this.outManager.Fp)).BeginInit();



            foreach (Neusoft.HISFC.Models.Material.Apply apply in alDetail)
            {
                Neusoft.HISFC.Models.Material.Output       output = new Neusoft.HISFC.Models.Material.Output();
                Neusoft.HISFC.Models.Material.MaterialItem item   = new Neusoft.HISFC.Models.Material.MaterialItem();

                item = this.itemManager.GetMetItemByMetID(apply.Item.ID);

                if (output.StoreBase.Item == null)
                {
                    MessageBox.Show("加载申请时 根据物资编码减少物资项目字典信息失败" + apply.Item.ID);
                    return(-1);
                }

                output.StoreBase.Item     = item;
                output.StoreBase.Quantity = apply.Operation.ApplyQty - apply.OutQty; //by yuyun 改为申请量 - 已审批量


                //liuxq改为审批量      //apply.Operation.ApplyQty;			 //申请量
                output.StoreBase.PriceCollection.RetailPrice = apply.ApplyPrice;    //wangw
                output.Memo = apply.Memo;                                           //备注信息

                decimal storeQty = 0;
                if (this.storeManager.GetStoreQty(this.outManager.DeptInfo.ID, apply.Item.ID, out storeQty) == -1)
                {
                    MessageBox.Show("获取" + apply.Item.Name + "库存数量时发生错误" + this.itemManager.Err);
                    return(-1);
                }
                output.StoreBase.StoreQty = storeQty;                            //库存量

                output.StoreBase.PrivType   = this.outManager.PrivType.ID;       //出库类型
                output.StoreBase.SystemType = this.outManager.PrivType.Memo;     //系统类型
                output.StoreBase.StockDept  = this.outManager.DeptInfo;          //当前科室
                //if (this.outManager.TargetDept != null && !string.IsNullOrEmpty(this.outManager.TargetDept.ID))
                //{
                //    output.StoreBase.TargetDept = this.outManager.TargetDept;	//目标科室
                //}
                //else
                //{
                output.StoreBase.TargetDept = myDept.GetDeptmentById(apply.StockDept.ID);//目标科室
                //}
                output.StoreBase.PriceCollection.PurchasePrice = item.UnitPrice;
                output.ApplyListCode = apply.ApplyListNO; //申请单号liuxq add
                output.ApplySerialNO = apply.SerialNO;    //申请单内序号liuxq add
                //将申请数量存入扩展字段 来处理部分审批出库 by yuyun 08-7-30
                output.StoreBase.Extend = output.StoreBase.Quantity.ToString();
                output.User01           = "1";                                                                                                       //数据来源 申请
                output.User02           = apply.ID;                                                                                                  //申请单流水号

                output.User03 = output.StoreBase.Item.ID.ToString() + output.StoreBase.PriceCollection.PurchasePrice.ToString() + apply.ApplyListNO; //设置主键

                if (this.AddDataToTable(output) == 1)
                {
                    this.hsOutData.Add(output.User03, output);

                    this.hsApplyData.Add(apply.ID, apply);

                    this.hsItemData.Add(output.User03, null);                   //设置已添加项目
                }
                if (apply == alDetail[0])
                {
                    Neusoft.HISFC.Models.Base.Employee person = myPerson.GetPersonByID(apply.Operation.ApproveOper.ID);

                    Neusoft.HISFC.Models.Base.Department dept = myDept.GetDeptmentById(apply.StockDept.ID);

                    if (person != null && dept != null)
                    {
                        this.showInfo = "申请单:" + apply.ApplyListNO + " 申请科室:" + dept.Name + " 科室审批:" + person.Name;
                    }
                }
            }

            ((System.ComponentModel.ISupportInitialize)(this.outManager.Fp)).EndInit();

            //计算汇总出库金额
            this.CompuateSum();

            return(1);
        }