Beispiel #1
0
        public FrmModifyAmount(ReturnHeaderEntity header)
        {
            InitializeComponent();

            headerEntity = header;
            rtnDal       = new ReturnManageDal();
        }
Beispiel #2
0
        public void ReturnComplete()
        {
            ReturnHeaderEntity header = IParent.GetFocusedBill();

            if (header == null)
            {
                MsgBox.Warn("请选中要完成的单据。");
                return;
            }
            if (header.BillState == "27")
            {
                MsgBox.Warn("该订单已经完成,请选择其他订单!");
                return;
            }
            if (MsgBox.AskOK("确定要完成该订单吗?") == DialogResult.OK)
            {
                bool result = CloseReturn(header.BillID);
                if (result)
                {
                    MsgBox.Warn("订单关闭完成!");
                    LogDal.Insert(ELogType.退货单, GlobeSettings.LoginedUser.UserName, header.BillNo, "手动完成退货单", "退货单管理");
                }
                //else
                //{
                //    MsgBox.Warn(result);
                //}
            }
        }
Beispiel #3
0
        public RepReturn(int billID, short copies)
            : this()
        {
            BillID      = billID;
            this.copies = copies;

            //获取数据
            try
            {
                header = rtnDal.GetHeaderInfoByBillID(BillID);
                List <ReturnDetailsEntity> details = rtnDal.GetReturnDetails(BillID);

                dataSource             = new ReturnBody();
                dataSource.CompanyInfo = new CompanyDal().GetCompanys()[0];
                dataSource.Header      = header;
                dataSource.Details     = details;
                //dataSource.Customer = new CustomerDal().GetByCode(header.Customer);
                lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd");
                lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
                lblSoNo.Text      = header.OriginalBillNo;
                this.PageHeight   = details.Count * 63 + 1150;
                //decimal totalAmount = header.CrnAmount;
                ////foreach (ReturnDetailsEntity itm in details)
                ////{
                ////    totalAmount += itm.ReturnAmount;
                ////}
                //totalAmount += header.ReturnAmount;
                //lblTotalAmount.Text = totalAmount.ToString();
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
        }
Beispiel #4
0
        public void RelatingStackInfo()
        {
            ReturnHeaderEntity header = IParent.GetFocusedBill();

            if (header == null)
            {
                MsgBox.Warn("请选中要查看的单据。");
                return;
            }
            FrmRelatingStack frm = new FrmRelatingStack(header);

            frm.ShowDialog();
        }
Beispiel #5
0
        /// <summary>
        /// 利用RowCellStyle给特殊的行标记字体颜色
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnHeaderRowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            GridView vw = (sender as GridView);

            try
            {
                ReturnHeaderEntity header = vw.GetRow(e.RowHandle) as ReturnHeaderEntity;
                if (header != null)
                {
                    if (header.RowColor != null)
                    {
                        e.Appearance.ForeColor = Color.FromArgb(header.RowColor.Value);
                    }
                }
            }
            catch (Exception ex) { }
        }
Beispiel #6
0
        public void ShowFocusDetail()
        {
            ReturnHeaderEntity selectedHeader = SelectedHeader;

            if (selectedHeader == null)
            {
                gridDetails.DataSource = null;
                gvDetails.ViewCaption  = "未选择单据!";
            }
            else
            {
                lstDetail = new List <ReturnDetailsEntity>();
                lstDetail = crnDal.GetReturnDetails(selectedHeader.BillID);
                gridDetails.DataSource = lstDetail;
                gvDetails.ViewCaption  = string.Format("单据号: {0};  客户名称:{1}", selectedHeader.BillNo, selectedHeader.CustomerName);
            }
        }
Beispiel #7
0
        public void DeleteReturnBill()
        {
            try
            {
                ReturnHeaderEntity header = IParent.GetFocusedBill();
                if (header == null)
                {
                    MsgBox.Warn("请选中要删除的单据。");
                    return;
                }
                if (header.StatusName != "等待清点")
                {
                    MsgBox.Warn("只有<等待清点>状态的单据才能删除。");
                    return;
                }
                if (header.BillTypeName == "系统退货单")
                {
                    MsgBox.Warn("<系统退货单>不能删除。");
                    return;
                }
                if (MsgBox.AskOK("确定要删除单据号为<" + header.BillNo + ">的退货单吗?") != DialogResult.OK)
                {
                    return;
                }

                int rtn = soDal.DeleteReturnBill(header.BillID);
                if (rtn > 0)
                {
                    MsgBox.OK("删除成功!");
                    Requery();
                }
                else
                {
                    MsgBox.OK("删除失败!");
                }
                LogDal.Insert(ELogType.退货单, GlobeSettings.LoginedUser.UserName, header.BillNo, "删除退货单", "退货单管理");
            }
            catch (Exception ex)
            {
                MsgBox.OK("删除失败,原因是:" + ex.Message);
                return;
            }
        }
Beispiel #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ReturnHeaderEntity header = SelectedHeader;
                if (header == null)
                {
                    MsgBox.Warn("没有选中单据!");
                    return;
                }
                if (header.StatusName != "等待清点")
                {
                    MsgBox.Warn("只有<等待清点>状态的单据可以修改!");
                    return;
                }
                if (lstDetail.Count == 0)
                {
                    MsgBox.Warn("没有需要保存的数据!");
                    return;
                }

                if (MsgBox.AskOK("确定保存该退货明细吗?") != DialogResult.OK)
                {
                    return;
                }
                int rtn = returnDal.UpdateReturnDetails(lstDetail);
                if (rtn >= 0)
                {
                    string detailStr = JsonConvert.SerializeObject(lstDetail);
                    LogDal.Insert(ELogType.退货单, GlobeSettings.LoginedUser.UserName, header.BillNo, detailStr, "退货单管理");
                    MsgBox.Warn("保存成功!");
                }
            }
            catch (Exception ex)
            {
                MsgBox.Warn(ex.Message);
                return;
            }
        }
Beispiel #9
0
        public void ModifyReturnAmount()
        {
            ReturnHeaderEntity header = IParent.GetFocusedBill();

            if (header == null)
            {
                MsgBox.Warn("请选中要修改的单据。");
                return;
            }
            if (header.StatusName != "等待清点")
            {
                MsgBox.Warn("只有<等待清点>状态的单据才能修改。");
                return;
            }
            FrmModifyAmount frm = new FrmModifyAmount(header);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                LogDal.Insert(ELogType.退货单, GlobeSettings.LoginedUser.UserName, header.BillNo,
                              string.Format("修改退货金额;修改前:{0}  修改后:{1}", header.CrnAmount, frm.CrnAmount),
                              "退货单管理");
                Requery();
            }
        }
Beispiel #10
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            ReturnHeaderEntity selectedHeader = SelectedHeader;

            if (selectedHeader.StatusName != "等待清点")
            {
                MsgBox.Warn("只有<等待清点>状态的单据可以修改!");
                return;
            }
            ReturnDetailsEntity selectDetail = SelectedDetail;

            if (selectDetail == null)
            {
                MsgBox.Warn("没有选中的行!");
                return;
            }
            if (string.IsNullOrEmpty(txtReturnQty.Text.Trim()))
            {
                MsgBox.Warn("退货数量不能为空!");
                txtReturnQty.Focus();
                return;
            }
            if (!ConvertUtil.IsDecimal(txtReturnQty.Text.Trim()))
            {
                MsgBox.Warn("退货数量必须是数字!");
                txtReturnQty.Focus();
                return;
            }
            if (ConvertUtil.ToDecimal(txtReturnQty.Text.Trim()) < 0)
            {
                MsgBox.Warn("退货数量不能小于0!");
                txtReturnQty.Focus();
                return;
            }
            if (ConvertUtil.ToString(listReturnUnit.EditValue) == string.Empty)
            {
                MsgBox.Warn("退货单位不能为空!");
                listReturnUnit.Focus();
                return;
            }
            try
            {
                decimal minReturnQty = 0;
                if (selectDetail.ReturnUnitCode == ConvertUtil.ToString(listReturnUnit.EditValue))
                {
                    minReturnQty = ConvertUtil.ToDecimal(txtReturnQty.Text.Trim());
                }
                else
                {
                    minReturnQty = selectDetail.CastRate * ConvertUtil.ToDecimal(txtReturnQty.Text.Trim());
                }

                if (minReturnQty > selectDetail.MinPickQty - selectDetail.ReturnedQty)
                {
                    MsgBox.Warn("退货数量超出!");
                    txtReturnQty.Focus();
                    return;
                }

                selectDetail.ReturnQty = minReturnQty;

                gvDetails.RefreshData();
                btnClear_Click(null, null);
            }
            catch (Exception ex)
            {
                MsgBox.Warn(ex.Message);
                return;
            }
        }
Beispiel #11
0
 public FrmRelatingStack(ReturnHeaderEntity header)
 {
     InitializeComponent();
     headerEntity = header;
     rtnDal       = new ReturnManageDal();
 }