コード例 #1
0
 /// <summary>
 /// 根据所赋值的库房编码 设置信息显示
 /// </summary>
 public void SetData()
 {
     Neusoft.HISFC.BizLogic.Material.Baseset       baseManager = new Neusoft.HISFC.BizLogic.Material.Baseset();
     Neusoft.HISFC.Models.Material.MaterialStorage deptCons    = baseManager.QueryStorageInfo(this.deptCode);
     if (deptCons == null)
     {
         MessageBox.Show("获取科室常数发生错误! \n" + baseManager.Err);
         return;
     }
     this.dtpEnd.Value        = baseManager.GetDateTimeFromSysDateTime().Date;
     this.dtpBegin.Value      = this.dtpEnd.Value.AddDays(-deptCons.ReferenceDays);
     this.txtMaxDays.Text     = deptCons.MaxDays.ToString();
     this.txtMinDays.Text     = deptCons.MinDays.ToString();
     this.lbIntervalDays.Text = deptCons.ReferenceDays.ToString() + "天";
 }
コード例 #2
0
        /// <summary>
        /// 科室列表数据加载
        /// </summary>
        /// <returns>数据加载成功返回1 加载存在错误返回-1</returns>
        protected virtual int InitDept()
        {
            Neusoft.HISFC.BizLogic.Material.Baseset matDeptManagment = new Neusoft.HISFC.BizLogic.Material.Baseset();
            deptList = matDeptManagment.GetStorageInfo("A", "A", "1", "A");
            if (deptList == null)
            {
                MessageBox.Show("获取科室数据发生错误" + matDeptManagment.Err);
                return(-1);
            }

            Hashtable hsDeptList = new Hashtable();

            foreach (Neusoft.HISFC.Models.Material.MaterialStorage dept in deptList)
            {
                hsDeptList.Add(dept.ID, dept);
            }

            return(1);
        }
コード例 #3
0
        /// <summary>
        /// 得到下级科目信息
        /// </summary>
        /// <param name="parm">本级科目编码</param>
        /// <returns>下级科目信息数组</returns>
        public ArrayList GetHasChildren(string parm)
        {
            Neusoft.HISFC.BizLogic.Material.Baseset matBase = new Neusoft.HISFC.BizLogic.Material.Baseset();

            return(matBase.QueryKindAllByPreID(parm));
        }
コード例 #4
0
        /// <summary>
        /// 保存
        /// </summary>
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            DialogResult rs = MessageBox.Show("确认向" + this.outManager.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();
            }

            FarPoint.Win.Spread.CellType.NumberCellType numberCellType = new FarPoint.Win.Spread.CellType.NumberCellType();
            numberCellType.DecimalPlaces = 4;
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColPurchasePrice].CellType = numberCellType;
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColOutCost].CellType       = numberCellType;
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColRetailPrice].CellType   = numberCellType;

            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.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            //t.BeginTransaction();
            Neusoft.HISFC.BizLogic.Material.Baseset matConstant = new Neusoft.HISFC.BizLogic.Material.Baseset();
            this.storeManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            //matConstant.SetTrans(t.Trans);

            #endregion

            DateTime sysTime = this.storeManager.GetDateTimeFromSysDateTime();

            #region 判断领用科室是否关联库存

            bool isManagerStore = false;
            Neusoft.HISFC.Models.Material.MaterialStorage matStorage = matConstant.QueryStorageInfo(this.outManager.TargetDept.ID);
            if (matStorage != null && matStorage.IsStoreManage)
            {
                isManagerStore = true;
            }

            isManagerStore = true;

            if (!isManagerStore)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                MessageBox.Show(this.outManager.TargetDept.Name + " 不管理库存,不能通过出库审批进行出库");
                return;
            }

            #endregion

            //出库单据号
            string outListNO = null;
            int    serialNO  = 0;
            Neusoft.HISFC.Models.Material.Output        output;
            List <Neusoft.HISFC.Models.Material.Output> alOutput = new List <Neusoft.HISFC.Models.Material.Output>();
            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = this.GetKey(dr);

                output = this.hsOutData[key] as Neusoft.HISFC.Models.Material.Output;

                if (this.GetOutputFormDataRow(dr, sysTime, ref output) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                    MessageBox.Show("获取出库明细信息失败");
                    return;
                }
                //判断是否选中该行
                if (!Neusoft.FrameWork.Function.NConvert.ToBoolean(dr["审批"]))
                {
                    continue;
                }
                //判断出库数量是否为0
                if (output.StoreBase.Quantity == 0)
                {
                    continue;
                }

                serialNO++;
                output.StoreBase.SerialNO = serialNO;

                #region 获取出库单据号

                if (outListNO == null)
                {
                    outListNO = output.OutListNO;
                }
                if (outListNO == null || outListNO == "")
                {
                    outListNO = this.storeManager.GetOutListNO(this.outManager.DeptInfo.ID);
                    if (outListNO == null)
                    {
                        Neusoft.FrameWork.Management.PublicTrans.RollBack();
                        Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                        MessageBox.Show("获取出库单据号发生错误");
                        return;
                    }
                }
                output.OutListNO = outListNO;

                #endregion

                #region 获取库存量

                decimal storeQty = 0;
                if (this.storeManager.GetStoreQty(output.StoreBase.StockDept.ID, output.StoreBase.Item.ID, out storeQty) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                    MessageBox.Show("获取库存数量时出错" + storeManager.Err);
                    return;
                }
                output.StoreBase.StoreQty  = storeQty;              //出库前库存数量
                output.StoreBase.StoreCost = Math.Round(output.StoreBase.StoreQty / output.StoreBase.Item.PackQty * output.StoreBase.PriceCollection.PurchasePrice, 3);

                #endregion

                #region 根据不同参数设置出库数据状态

                if (isManagerStore)               //目标(领用)科室管理库存
                {
                    output.StoreBase.State = "1"; //审核
                }
                else
                {
                    output.StoreBase.State = "2";         //核准
                }
                if (output.StoreBase.State == "2")
                {
                    output.StoreBase.Operation.ApproveOper = output.StoreBase.Operation.Oper;
                }

                #endregion
                if (this.storeManager.Output(output) == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                    MessageBox.Show("出库保存发生错误" + this.storeManager.Err);
                    return;
                }
                if (output.StoreBase.PrivType == "04")
                {
                    //判断出库数量和申请数量 如果出库数量小于申请数量 则为部分审批  by yuyun 08-7-31
                    if (output.StoreBase.Quantity >= Neusoft.FrameWork.Function.NConvert.ToDecimal(output.StoreBase.Extend))
                    {
                        //全部审批
                        //将state更新成P  extend1更新成3  approve_num更新成approve_num+出库数量
                        if (this.storeManager.UpdateApplyState(output.StoreBase.TargetDept.ID, output.ApplyListCode, output.ApplySerialNO, "P", output.StoreBase.Operation.Oper.ID, output.StoreBase.Operation.Oper.OperTime, output.StoreBase.Quantity, "3", output.StoreBase.Memo) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("出库更新发生错误 " + this.storeManager.Err);
                            return;
                        }
                    }
                    else
                    {
                        //部分审批
                        //将state更新成0  extend1更新成9  approve_num更新成approve_num+出库数量
                        if (this.storeManager.UpdateApplyState(output.StoreBase.TargetDept.ID, output.ApplyListCode, output.ApplySerialNO, "0", output.StoreBase.Operation.Oper.ID, output.StoreBase.Operation.Oper.OperTime, output.StoreBase.Quantity, "9", output.StoreBase.Memo) == -1)
                        {
                            Neusoft.FrameWork.Management.PublicTrans.RollBack();
                            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                            MessageBox.Show("出库更新发生错误 " + this.storeManager.Err);
                            return;
                        }
                    }
                }

                alOutput.Add(output);
            }

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

            MessageBox.Show("保存成功");
            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();

            if (alOutput.Count > 0)
            {
                if (MessageBox.Show("是否打印?", "提示:", System.Windows.Forms.MessageBoxButtons.YesNo)
                    == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Print(alOutput);
                }

                /*
                 * if (MessageBox.Show("是否打印?", "提示:", System.Windows.Forms.MessageBoxButtons.YesNo)
                 *  == System.Windows.Forms.DialogResult.Yes)
                 * {
                 *  Local.GyHis.Material.ucMatOutput ucMat = new Local.GyHis.Material.ucMatOutput();
                 *  ucMat.Decimals = 2;
                 *  ucMat.MaxRowNo = 17;
                 *
                 *  ucMat.SetDataForInput(alOutput, 1, this.itemManager.Operator.ID, "1");
                 * }
                 * */
            }

            this.Clear();
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColPurchasePrice].CellType = numberCellType;
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColOutCost].CellType       = numberCellType;
            this.outManager.FpSheetView.Columns[(int)ColumnSet.ColRetailPrice].CellType   = numberCellType;
        }