Ejemplo n.º 1
0
        /// <summary>
        /// 根据物品编码与批次号加入入库退库信息
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="stockNO"></param>
        /// <returns></returns>
        protected virtual int AddInData(string itemCode, int stockNO)
        {
            if (this.hsInData.ContainsKey(itemCode + stockNO.ToString()))
            {
                MessageBox.Show("该物品已添加");
                return(0);
            }
            List <Neusoft.HISFC.Models.Material.StoreDetail> alDetail = this.storeManager.QueryStoreList(this.matInManager.DeptInfo.ID, itemCode, stockNO.ToString(), true);

            if (alDetail == null || alDetail.Count == 0)
            {
                MessageBox.Show("未获取有效的库存明细信息" + this.storeManager.Err);
                return(-1);
            }

            Neusoft.HISFC.Models.Material.StoreDetail storeDetail = alDetail[0];

            Neusoft.HISFC.Models.Material.Input input = new Neusoft.HISFC.Models.Material.Input();

            input.StoreBase          = storeDetail.StoreBase;                           //库存基本信息
            input.StoreBase.Quantity = storeDetail.StoreBase.StoreQty;                  //入库量 = 库存量

            input.Memo = storeDetail.Memo;

            if (this.AddDataToTable(input) == 1)
            {
                this.hsInData.Add(itemCode + stockNO.ToString(), input);
            }

            this.SetFormat();

            this.SetFocusSelect();

            return(1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将实体信息加入DataTable内
        /// </summary>
        /// <param name="input">入库信息</param>
        /// <returns></returns>
        protected virtual int AddDataToTable(Neusoft.HISFC.Models.Material.Input input)
        {
            if (this.dt == null)
            {
                this.InitDataTable();
            }

            try
            {
                input.InCost = input.StoreBase.Quantity * input.StoreBase.PriceCollection.PurchasePrice;
                decimal storeQty = 0;
                this.storeManager.GetStoreQty(this.matInManager.DeptInfo.ID, input.StoreBase.Item.ID, input.StoreBase.StockNO, out storeQty);

                this.dt.Rows.Add(new object[] {
                    input.StoreBase.Item.Name,                                                                  //物品名称
                    input.StoreBase.Item.Specs,                                                                 //规格
                    input.StoreBase.BatchNO,                                                                    //批号
                    input.StoreBase.PriceCollection.PurchasePrice,                                              //购入价
                    input.StoreBase.Item.MinUnit,                                                               //最小单位(计量单位)
                    storeQty,                                                                                   //入库数量
                    input.InCost,                                                                               //入库金额
                    0,                                                                                          //退库数量
                    0,                                                                                          //退库金额
                    input.InvoiceNO,                                                                            //发票号
                    input.InvoiceTime,
                    input.Memo,                                                                                 //备注
                    input.StoreBase.Item.ID,                                                                    //物品
                    input.StoreBase.StockNO,                                                                    //批次
                    input.StoreBase.Item.SpellCode,                                                             //拼音码
                    input.StoreBase.Item.WBCode,                                                                //五笔码
                    input.StoreBase.Item.UserCode                                                               //自定义码
                }
                                 );
            }
            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);
        }
Ejemplo n.º 3
0
        /// <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";
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 项目信息加入
        /// </summary>
        /// <param name="sv"></param>
        /// <param name="activeRow"></param>
        /// <returns></returns>
        public int AddItem(FarPoint.Win.Spread.SheetView sv, int activeRow)
        {
            string inNO = sv.Cells[activeRow, 5].Text;
            //			string stockNO = sv.Cells[activeRow, 6].Text;

            ArrayList al = this.itemManager.QueryInputDetailByInNO(inNO, "0");

            Neusoft.HISFC.Models.Material.Input input = new Neusoft.HISFC.Models.Material.Input();

            foreach (Neusoft.HISFC.Models.Material.Input info in al)
            {
                input = info;
            }

            if (input == null)
            {
                MessageBox.Show(this.itemManager.Err);
                return(-1);
            }
            //{9E7FB328-89B3-4f43-A417-2EC3ACFC7093}
            //已经用流水号做主键了
            if (this.hsInData.ContainsKey(input.ID))//input.StoreBase.Item.ID + input.ID
            {
                MessageBox.Show("该物品已添加");
                return(-1);
            }

            if (this.AddDataToTable(input) == 1)
            {
                //{9E7FB328-89B3-4f43-A417-2EC3ACFC7093}
                //已经用流水号做主键了
                this.hsInData.Add(input.ID, input);//input.StoreBase.Item.ID + input.ID
            }

            this.SetFormat();

            this.SetFocusSelect();

            return(1);
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 入库单据打印
        /// </summary>
        /// <param name="al"></param>
        /// <param name="inow"></param>
        /// <param name="icount"></param>
        /// <param name="operCode"></param>
        private void PrintInput(List <Neusoft.HISFC.Models.FeeStuff.Input> al, int inow, int icount, string operCode)
        {
            if (al.Count <= 0)
            {
                MessageBox.Show("无打印数据!");
                return;
            }
            #region LABLE赋值

            Neusoft.HISFC.Models.Material.Input input = (Neusoft.HISFC.Models.Material.Input)al[0];

            this.lbDept.Text += this.detpManager.GetDeptmentById(input.StoreBase.StockDept.ID);

            this.lbTitle.Text = this.detpManager.GetDeptmentById(input.StoreBase.StockDept.ID) + "物资入库单";

            this.lbTime.Text = this.psManager.GetSysDateTime("yyyy.MM.dd");

            this.lbPageNum.Text = "第" + inow.ToString() + "页/共" + icount.ToString() + "页";

            #endregion


            decimal sum4 = 0;
            decimal sum5 = 0;
            decimal sum6 = 0;
            decimal sum7 = 0;
            decimal sum8 = 0;
            this.sheetView1.RowCount = 0;
            for (int i = 0; i < al.Count; i++)
            {
                this.sheetView1.AddRows(i, 1);
                Neusoft.HISFC.Models.Material.Input info = al[i] as Neusoft.HISFC.Models.Material.Input;

                this.sheetView1.Cells[i, 0].Text  = info.StoreBase.Item.Name;
                this.sheetView1.Cells[i, 1].Text  = info.StoreBase.Item.Specs;
                this.sheetView1.Cells[i, 2].Text  = info.StoreBase.Quantity.ToString();
                this.sheetView1.Cells[i, 3].Text  = info.StoreBase.Item.PriceUnit;
                this.sheetView1.Cells[i, 4].Text  = info.StoreBase.PriceCollection.RetailPrice.ToString();
                this.sheetView1.Cells[i, 5].Text  = info.StoreBase.PriceCollection.PurchasePrice.ToString();
                this.sheetView1.Cells[i, 6].Text  = (info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity).ToString();
                this.sheetView1.Cells[i, 7].Text  = (info.StoreBase.PriceCollection.PurchasePrice * info.StoreBase.Quantity).ToString();
                this.sheetView1.Cells[i, 8].Text  = (info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity - info.StoreBase.PriceCollection.PurchasePrice * info.StoreBase.Quantity).ToString();
                this.sheetView1.Cells[i, 9].Text  = info.StoreBase.ValidTime.ToString();
                this.sheetView1.Cells[i, 10].Text = info.StoreBase.BatchNO.ToString();
                if (this.comManager.QueryCompanyByCompanyID(info.StoreBase.Producer.ID, "A", "0") != null)
                {
                    this.sheetView1.Cells[i, 11].Text = this.comManager.QueryCompanyByCompanyID(info.StoreBase.Producer.ID, "A", "0").Name.ToString();
                }
                else
                {
                    this.sheetView1.Cells[i, 11].Text = "未录入";
                }
                sum4 += info.StoreBase.PriceCollection.RetailPrice;
                sum5 += info.StoreBase.PriceCollection.PurchasePrice;
                sum6 += (info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity);
                sum7 += (info.StoreBase.PriceCollection.PurchasePrice * info.StoreBase.Quantity);
                sum8 += (info.StoreBase.PriceCollection.RetailPrice * info.StoreBase.Quantity - info.StoreBase.PriceCollection.PurchasePrice * info.StoreBase.Quantity);
            }
            this.sheetView1.RowCount = al.Count + 1;
            this.sheetView1.Cells[al.Count, 0].Text = "合计";
            this.sheetView1.Cells[al.Count, 4].Text = sum4.ToString();
            this.sheetView1.Cells[al.Count, 5].Text = sum5.ToString();
            this.sheetView1.Cells[al.Count, 6].Text = sum6.ToString();
            this.sheetView1.Cells[al.Count, 7].Text = sum7.ToString();
            this.sheetView1.Cells[al.Count, 8].Text = sum8.ToString();

            this.fpSpread1.Height = (int)this.sheetView1.RowHeader.Rows[0].Height +
                                    (int)(this.sheetView1.Rows[0].Height * (al.Count + 1)) + 10;

            Neusoft.FrameWork.WinForms.Classes.Print print = null;
            try
            {
                print = new Neusoft.FrameWork.WinForms.Classes.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show("初始化打印机失败!" + ex.Message);
            }
            print.PrintPage(12, 2, this.neuPanel1);
            this.sheetView1.RowCount = 0;
        }
Ejemplo n.º 7
0
        // <summary>
        /// 保存
        /// </summary>
        public void Save()
        {
            if (!this.Valid())
            {
                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.ucInManager.FpSheetView.Columns[(int)ColumnSet.ColPurchasePrice].CellType = numberCellType;
            this.ucInManager.FpSheetView.Columns[(int)ColumnSet.ColInCost].CellType        = numberCellType;

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            //定义事务
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

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

            this.itemManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.itemManager.GetDateTimeFromSysDateTime();

            ArrayList alInput = new ArrayList();

            foreach (DataRow dr in dtAddMofity.Rows)
            {
                string key = dr["流水号"].ToString() + dr["库存序号"].ToString();

                //没有输入发票号的不保存
                if (dr["发票号"] == null || dr["发票号"].ToString().Trim() == "")
                {
                    continue;
                }

                //				Neusoft.HISFC.Models.Material.Input input = this.hsInData[key] as Neusoft.HISFC.Models.Material.Input;
                Neusoft.HISFC.Models.Material.Input input = new Neusoft.HISFC.Models.Material.Input();

                input.StoreBase.Operation.ExamOper.ID       = this.ucInManager.OperInfo.ID.ToString(); //审批人
                input.StoreBase.Operation.ExamOper.OperTime = sysTime;                                 //审批时间
                input.InvoiceNO         = dr["发票号"].ToString().Trim();
                input.InvoiceTime       = NConvert.ToDateTime(dr["发票日期"].ToString().Trim());
                input.ID                = dr["流水号"].ToString();
                input.StoreBase.StockNO = dr["库存序号"].ToString();
                //				input.StoreBase.PriceCollection.PurchasePrice = NConvert.ToDecimal(dr["购入价"]);
                //				input.StoreBase.PurchaseCost = NConvert.ToDecimal(dr["购入金额"]);

                int parm = this.itemManager.ExamInput(input);
                if (parm == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(this.itemManager.Err);
                    return;
                }
                if (parm == 0)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("数据可能已被审核,请刷新重试");
                    return;
                }

                alInput.Add(input);
            }

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

            MessageBox.Show("补录发票成功");

            //			if(alInput.Count > 0)
            //			{
            //				Local.GyHis.Material.ucMatInput ucMat = new Local.GyHis.Material.ucMatInput();
            //				ucMat.Decimals = 2;
            //				ucMat.MaxRowNo = 17;
            //
            //				ucMat.SetDataForInput(alInput,1,this.itemManager.Operator.ID,"1");
            //
            //			}

            //清屏显示
            this.Clear();
            this.ShowSelectData();

            FarPoint.Win.Spread.CellType.NumberCellType numCellType = new FarPoint.Win.Spread.CellType.NumberCellType();
            numCellType.DecimalPlaces = 4;
            this.ucInManager.FpSheetView.Columns[(int)ColumnSet.ColPurchasePrice].CellType = numCellType;
            this.ucInManager.FpSheetView.Columns[(int)ColumnSet.ColInCost].CellType        = numCellType;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加物品项目
 /// </summary>
 /// <param name="item"></param>
 /// <param name="parms"></param>
 public int AddItem(FarPoint.Win.Spread.SheetView sv, Neusoft.HISFC.Models.Material.Input input)
 {
     return(0);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 将实体信息加入DataTable内
        /// </summary>
        /// <param name="input">入库信息</param>
        /// <returns></returns>
        protected virtual int AddDataToTable(Neusoft.HISFC.Models.Material.Input input)
        {
            if (this.dt == null)
            {
                this.InitDataTable();
            }

            try
            {
                decimal inQty   = 0;                          //入库数量 (根据参数以包装单位或最小单位显示)
                decimal inPrice = 0;                          //入库购入价 根据参数决定包装价格或最小单位价格
                string  inUnit  = "";                         //入库单位 (根据参数以包装单位或最小单位显示)

                if (this.isUsePackIn)                         //按包装单位入库
                {
                    inQty   = input.PackInQty;                //包装数量入库
                    inPrice = input.StoreBase.Item.PackPrice; //包装单位价格
                    inUnit  = input.StoreBase.Item.PackUnit;  //包装单位
                }
                else
                {
                    inQty   = input.StoreBase.Quantity;                                         //最小数量入库
                    inPrice = input.StoreBase.PriceCollection.PurchasePrice;                    //最小单位价格
                    inUnit  = input.StoreBase.Item.MinUnit;                                     //最小单位
                }

                this.dt.Rows.Add(new object[] {
                    input.StoreBase.Item.Name,                                                                                                          //物品名称
                    input.StoreBase.Item.Specs,                                                                                                         //规格
                    inUnit,                                                                                                                             //包装单位
                    input.StoreBase.Item.PackQty,                                                                                                       //包装数量
                    inQty,                                                                                                                              //入库数量
                    inPrice,                                                                                                                            //购入价
                    input.InCost,                                                                                                                       //购入金额 (购入价金额)
                    input.StoreBase.BatchNO,                                                                                                            //批号
                    input.StoreBase.ValidTime,                                                                                                          //有效期
                    input.InvoiceNO,                                                                                                                    //发票号
                    input.InvoiceTime,                                                                                                                  //发票日期
                    input.StoreBase.PriceCollection.RetailPrice,                                                                                        //零售价 最小单位零售价
                    input.StoreBase.RetailCost,                                                                                                         //零售金额
                    input.StoreBase.Producer.Name,                                                                                                      //生产厂家
                    input.StoreBase.Item.ID,                                                                                                            //项目编码
                    input.ID,                                                                                                                           //流水号
                    input.StoreBase.StockNO,                                                                                                            //库存序号
                    input.StoreBase.Item.SpellCode,                                                                                                     //拼音码
                    input.StoreBase.Item.WbCode,                                                                                                        //五笔码
                    input.StoreBase.Item.UserCode,                                                                                                      //自定义码
                }
                                 );
            }
            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);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 保存
        /// </summary>
        public void Save()
        {
            if (!this.Valid())
            {
                return;
            }

            this.dt.DefaultView.RowFilter = "1=1";
            for (int i = 0; i < this.dt.DefaultView.Count; i++)
            {
                this.dt.DefaultView[i].EndEdit();
            }

            DataTable dtAddMofity = this.dt.GetChanges(DataRowState.Added | DataRowState.Modified);

            if (dtAddMofity == null || dtAddMofity.Rows.Count <= 0)
            {
                return;
            }

            //定义事务
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            this.storeManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            DateTime sysTime = this.storeManager.GetDateTimeFromSysDateTime();

            #region 获取退库单号

            string inListNO = this.storeManager.GetInListNO(this.matInManager.DeptInfo.ID);

            if (inListNO == null)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                MessageBox.Show("获取最新退库单号出错" + storeManager.Err);
                return;
            }

            #endregion

            //标志是否存在保存操作
            bool isSaveOperation = false;
            this.alInput = new List <Neusoft.HISFC.Models.Material.Input>();

            foreach (DataRow dr in dtAddMofity.Rows)
            {
                decimal backQty = NConvert.ToDecimal(dr["退库数量"]);
                if (backQty == 0)
                {
                    continue;
                }

                Neusoft.HISFC.Models.Material.Input input = this.hsInData[this.GetKey(dr)] as Neusoft.HISFC.Models.Material.Input;

                //---------广一的
                //				input.InCost = this.GetPrice(input.InCost);
                //---------

                #region 获取本批次当前库存 判断是否允许退库

                decimal storeQty = 0;
                this.storeManager.GetStoreQty(this.matInManager.DeptInfo.ID, input.StoreBase.Item.ID, input.StoreBase.StockNO, out storeQty);
                if (storeQty < backQty)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(input.StoreBase.Item.Name + " 库存数量不足 退库数量过大");
                    return;
                }

                #endregion

                input.StoreBase.PrivType     = this.matInManager.PrivType.ID;
                input.StoreBase.SystemType   = this.matInManager.PrivType.Memo;
                input.StoreBase.Company.Name = this.matInManager.TargetDept.Name;

                #region 退库信息赋值

                input.InListNO           = inListNO;                                                                            //退库单号
                input.StoreBase.Quantity = -backQty;                                                                            //入库数量(负数)
                input.PackInQty          = input.StoreBase.Quantity * input.StoreBase.Item.PackQty;

                input.InCost              = input.StoreBase.Quantity * input.StoreBase.PriceCollection.PurchasePrice;
                input.StoreBase.StoreQty  = storeQty;                                                                           //入库前库存数量
                input.StoreBase.StoreCost = input.StoreBase.StoreQty * input.StoreBase.PriceCollection.PurchasePrice;

                input.StoreBase.Operation.ApplyOper.ID       = this.matInManager.OperInfo.ID;
                input.StoreBase.Operation.ApplyOper.OperTime = sysTime;
                input.StoreBase.Operation.Oper = input.StoreBase.Operation.ApplyOper;
                //根据不同发票输入情况及控制参数设置状态
                input.StoreBase.State = "0";
                input.InvoiceNO       = dr["发票号"].ToString();
                input.InvoiceTime     = Neusoft.FrameWork.Function.NConvert.ToDateTime(dr["发票日期"]);

                if (input.InvoiceNO != "")
                {
                    input.StoreBase.Operation.ExamQty  = input.StoreBase.Quantity;
                    input.StoreBase.Operation.ExamOper = input.StoreBase.Operation.Oper;
                    input.StoreBase.State = "1";                                                                                //直接更新状态为 审核(发票入库)状态
                }
                if (!this.IsNeedApprove)                                                                                        //不需核准 直接设置状态"2"
                {
                    input.StoreBase.State                 = "2";
                    input.StoreBase.Operation.ExamQty     = input.StoreBase.Quantity;
                    input.StoreBase.Operation.ExamOper    = input.StoreBase.Operation.Oper;
                    input.StoreBase.Operation.ApproveOper = input.StoreBase.Operation.Oper;
                }

                #endregion

                #region 退库保存

                int parm = this.storeManager.Input(input, "1", this.IsNeedApprove ? "0" : "1");
                if (parm == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("保存 [" + input.StoreBase.Item.Name + "] 发生错误 " + this.storeManager.Err);
                    return;
                }
                else if (parm == 0)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("数据可能已被审核,请刷新重试!");
                    return;
                }

                #endregion

                isSaveOperation = true;

                alInput.Add(input);
            }

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

            if (isSaveOperation)
            {
                MessageBox.Show("入库退库操作成功");
            }

            if (alInput.Count > 0)
            {
                if (MessageBox.Show("是否打印?", "提示:", System.Windows.Forms.MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
                    == System.Windows.Forms.DialogResult.Yes)
                {
                    /*
                     * Material.uc ucMat = new Material.ucMatInput();
                     * ucMat.Decimals = 2;
                     * ucMat.MaxRowNo = 17;
                     *
                     * ucMat.SetDataForInput(alInput, 1, this.storeManager.Operator.ID, "1");
                     * */

                    //ucMat.SetDataForInput(alInput, 1, this.itemManager.Operator.ID, "1");
                    //{86B8ED47-06CF-4a8e-8768-2AE929E3E8E7}打印
                    this.Print();
                }
            }

            this.Clear();
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 获取主键值
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 private string GetKey(Neusoft.HISFC.Models.Material.Input input)
 {
     return(input.StoreBase.Item.ID + input.StoreBase.StockNO.ToString());
 }