/// <summary>
        /// 根据Dr内数据对实体进行赋值
        /// </summary>
        /// <param name="dr">数据表</param>
        /// <param name="sysTime">当前时间</param>
        /// <param name="output">ref 出库实体信息</param>
        /// <returns>成功返回1 失败返回-1</returns>
        protected virtual int GetOutputFormDataRow(DataRow dr, DateTime sysTime, ref Neusoft.HISFC.Models.Material.Output output)
        {
            //出库数量
            if (this.isUseMinUnit)                      //使用最小单位
            {
                output.StoreBase.Quantity = NConvert.ToDecimal(dr["出库数量"]);
            }
            else
            {
                output.StoreBase.Quantity = NConvert.ToDecimal(dr["出库数量"]) * output.StoreBase.Item.PackQty;
            }

            output.StoreBase.Operation.Oper.ID       = this.outManager.OperInfo.ID;
            output.StoreBase.Operation.Oper.OperTime = sysTime;

            output.StoreBase.Operation.ExamOper = output.StoreBase.Operation.Oper;              //审批人
            output.StoreBase.Operation.ExamQty  = output.StoreBase.Quantity;

            output.Memo = dr["备注"].ToString();                                                                          //备注
            if (this.outManager.TargetPerson != null)                                                                   //领药人
            {
                output.GetPerson = this.outManager.TargetPerson;
            }

            output.StoreBase.PrivType   = this.outManager.PrivType.ID;             //出库类型
            output.StoreBase.SystemType = this.outManager.PrivType.Memo;           //系统类型
            output.StoreBase.StockDept  = this.outManager.DeptInfo;                //当前科室
            output.StoreBase.TargetDept = myDept.GetDeptmentById(dr["目标科室"].ToString());
            //this.outManager.TargetDept;              //目标科室

            //借方科目 暂时赋值为空
            output.Debit = "";

            return(1);
        }
        /// <summary>
        /// 将实体信息加入DataTable内
        /// </summary>
        /// <param name="output">出库信息 Output.User01存储数据来源</param>
        /// <returns></returns>
        protected virtual int AddDataToTable(Neusoft.HISFC.Models.Material.Output output)
        {
            if (this.dt == null)
            {
                this.InitDataTable();
            }

            try
            {
                decimal storeQty = output.StoreBase.StoreQty;
                decimal outQty   = output.StoreBase.Quantity;
                decimal outCost  = output.StoreBase.Quantity * output.StoreBase.PriceCollection.PurchasePrice;

                if (!this.isUseMinUnit)                 //使用包装单位进行出库
                {
                    storeQty = output.StoreBase.StoreQty / output.StoreBase.Item.PackQty;
                    outQty   = output.StoreBase.Quantity / output.StoreBase.Item.PackQty;
                }

                if (this.isUseMinUnit)
                {
                    this.dt.Rows.Add(new object[] {
                        true,
                        output.StoreBase.Item.Name,                                                       //物品名称
                        output.StoreBase.Item.Specs,                                                      //规格
                        output.StoreBase.BatchNO,                                                         //批号
                        output.StoreBase.PriceCollection.PurchasePrice,                                   //购入价
                        output.StoreBase.PriceCollection.RetailPrice,                                     //零售价
                        output.StoreBase.Item.PackUnit,                                                   //包装单位
                        output.StoreBase.Item.MinUnit,                                                    //最小单位
                        storeQty,                                                                         //库存数量
                        outQty,                                                                           //出库数量
                        outCost,                                                                          //出库金额
                        output.Memo,                                                                      //备注
                        output.StoreBase.Item.ID,                                                         //项目编码
                        output.User01,                                                                    //数据来源
                        output.StoreBase.Item.SpellCode,                                                  //拼音码
                        output.StoreBase.Item.WbCode,                                                     //五笔码
                        output.StoreBase.Item.UserCode,                                                   //自定义码
                        output.User03,                                                                    //主键
                        output.StoreBase.TargetDept.ID                                                    //目标科室
                    }
                                     );
                }
            }
            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);
        }
        /// <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>
        /// 将查询到的单据加入表格中
        /// </summary>
        /// <param name="alListInfo"></param>
        private void AddDataToSheet(ArrayList alListInfo)
        {
            Neusoft.HISFC.BizLogic.Manager.Department  deptManager      = new Neusoft.HISFC.BizLogic.Manager.Department();
            Neusoft.HISFC.BizProcess.Integrate.Manager managerIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Manager();
            foreach (object obj in alListInfo)
            {
                if (this.rbtInputList.Checked)
                {
                    Neusoft.HISFC.Models.Material.Input input = obj as Neusoft.HISFC.Models.Material.Input;

                    this.neuSpread1_Sheet1.AddRows(this.neuSpread1_Sheet1.RowCount, 1);
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.ListNO].Text     = input.InListNO;
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.InvoiceNO].Text  = input.InvoiceNO;
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.OperType].Text   = input.StoreBase.Extend;
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.TargetDept].Text = input.StoreBase.TargetDept.ID;
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.OperDate].Text   = input.StoreBase.Operation.Oper.OperTime.ToString();

                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.ListNO].Tag = cmbStorage.Tag.ToString();
                    this.neuSpread1_Sheet1.Rows[this.neuSpread1_Sheet1.RowCount - 1].Tag = "input";
                }
                else
                {
                    Neusoft.HISFC.Models.Material.Output output = obj as Neusoft.HISFC.Models.Material.Output;

                    this.neuSpread1_Sheet1.AddRows(this.neuSpread1_Sheet1.RowCount, 1);
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.ListNO].Text    = output.OutListNO;
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.InvoiceNO].Text = "";
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.OperType].Text  = output.StoreBase.Extend;

                    Neusoft.HISFC.Models.Base.Department dept = deptManager.GetDeptmentById(output.StoreBase.TargetDept.ID);
                    if (dept != null)
                    {
                        this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.TargetDept].Text = dept.Name;
                    }
                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.OperDate].Text = output.StoreBase.Operation.Oper.OperTime.ToString();

                    this.neuSpread1_Sheet1.Cells[this.neuSpread1_Sheet1.RowCount - 1, (int)ColSheet1.ListNO].Tag = cmbStorage.Tag.ToString();
                    this.neuSpread1_Sheet1.Rows[this.neuSpread1_Sheet1.RowCount - 1].Tag = "output";
                }
            }
        }
        public override int Print(object sender, object neuObject)
        {
            if (this.neuSpread2_Sheet1.RowCount == 0)
            {
                MessageBox.Show("请双击选择要补打的单据");

                return(-1);
            }
            //判断是入库单补打还是出库单补打
            if (this.neuSpread2_Sheet1.Cells[0, (int)ColSheet2.ItemCode].Tag.ToString() == "input")
            {
                Function.IPrint = inputInstance as Neusoft.HISFC.BizProcess.Interface.Material.IBillPrint;
                List <Neusoft.HISFC.Models.Material.Input> list = new List <Neusoft.HISFC.Models.Material.Input>();
                foreach (FarPoint.Win.Spread.Row r in neuSpread2_Sheet1.Rows)
                {
                    Neusoft.HISFC.Models.Material.Input input = neuSpread2_Sheet1.Rows[r.Index].Tag as Neusoft.HISFC.Models.Material.Input;
                    list.Add(input);
                }
                Function.IPrint.SetData(list);
            }
            else
            {
                Function.IPrint = outputInstance as Neusoft.HISFC.BizProcess.Interface.Material.IBillPrint;
                List <Neusoft.HISFC.Models.Material.Output> list = new List <Neusoft.HISFC.Models.Material.Output>();
                foreach (FarPoint.Win.Spread.Row r in neuSpread2_Sheet1.Rows)
                {
                    Neusoft.HISFC.Models.Material.Output output = neuSpread2_Sheet1.Rows[r.Index].Tag as Neusoft.HISFC.Models.Material.Output;
                    list.Add(output);
                }
                Function.IPrint.SetData(list);
            }

            this.Clear();
            return(1);

            return(base.Print(sender, neuObject));
        }
Beispiel #6
0
        /// <summary>
        /// 打印方法
        /// </summary>
        /// <param name="alPrint"></param>
        /// <param name="inow"></param>
        /// <param name="icount"></param>
        /// <returns></returns>
        public void OutputPrint(List <Neusoft.HISFC.Models.FeeStuff.Output> alPrint, int inow, int icount)
        {
            if (alPrint.Count <= 0)
            {
                MessageBox.Show("无打印数据!");
                return;
            }

            #region LABLE 赋值

            Neusoft.HISFC.Models.Material.Output output = alPrint[0] as Neusoft.HISFC.Models.Material.Output;
            this.lbTitle.Text  = this.deptManager.GetDeptmentById(output.StoreBase.StockDept.ID) + "物资出库单";
            this.lbDept.Text  += this.deptManager.GetDeptmentById(output.StoreBase.TargetDept.ID);
            this.lbTime.Text   = output.StoreBase.Operation.ExamOper.OperTime.ToString("yyyy.MM.dd");
            this.lbPagNum.Text = "第" + inow.ToString() + "页/共" + icount.ToString() + "页";

            #endregion

            #region FarPoint赋值

            this.sheetView1.RowCount = 0;
            decimal sum5 = 0;
            decimal sum6 = 0;
            for (int i = 0; i < alPrint.Count; i++)
            {
                this.sheetView1.AddRows(i, 1);
                Neusoft.HISFC.Models.Material.Output info = alPrint[i] as Neusoft.HISFC.Models.Material.Output;
                //{D306B133-1E9E-4f75-9458-EB8B0C820425} 使用info而不是output
                this.sheetView1.Cells[i, 0].Text = (i + 1).ToString();
                this.sheetView1.Cells[i, 1].Text = info.StoreBase.Item.Name;
                this.sheetView1.Cells[i, 2].Text = info.StoreBase.Item.Specs;
                this.sheetView1.Cells[i, 3].Text = info.StoreBase.Quantity.ToString();
                this.sheetView1.Cells[i, 4].Text = info.StoreBase.Item.PriceUnit;
                this.sheetView1.Cells[i, 5].Text = info.StoreBase.PriceCollection.RetailPrice.ToString();
                this.sheetView1.Cells[i, 6].Text = (info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity).ToString();
                this.sheetView1.Cells[i, 7].Text = info.StoreBase.BatchNO.ToString();
                this.sheetView1.Cells[i, 8].Text = info.StoreBase.ValidTime.ToString("yyyy.MM.dd");
                this.sheetView1.Cells[i, 9].Text = info.OutListNO;
                sum5 += info.StoreBase.PriceCollection.RetailPrice;
                sum6 += info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity;
                //-------------------------------------------------
            }
            this.sheetView1.RowCount = alPrint.Count + 1;
            this.sheetView1.Cells[alPrint.Count, 0].Text = "合计";
            this.sheetView1.Cells[alPrint.Count, 5].Text = sum5.ToString();
            this.sheetView1.Cells[alPrint.Count, 6].Text = sum6.ToString();
            this.fpSpread1.Height = (int)this.sheetView1.RowHeader.Rows[0].Height +
                                    (int)(this.sheetView1.Rows[0].Height * (alPrint.Count + 1)) + 10;

            #endregion

            Neusoft.FrameWork.WinForms.Classes.Print pri = null;
            try
            {
                pri = new Neusoft.FrameWork.WinForms.Classes.Print();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("初始化打印机失败" + ex.Message);
            }

            pri.PrintPage(12, 2, this.neuPanel1);
        }
 /// <summary>
 /// 根据项目实体获取主键
 /// </summary>
 /// <param name="output"></param>
 /// <returns></returns>
 private string GetKey(Neusoft.HISFC.Models.Material.Output output)
 {
     return(output.User03);
 }
        /// <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);
        }