예제 #1
0
        private void ShowFocusReturnDetails()
        {
            try
            {
                ReturnDetailsEntity selectDetail = SelectedDetail;
                GetReturnUnit(selectDetail.SkuCode);

                txtReturnQty.Text        = selectDetail.ReturnQty.ToString();
                listReturnUnit.EditValue = selectDetail.ReturnUnitCode;
            }
            catch (Exception ex)
            {
                MsgBox.Warn(ex.Message);
                return;
            }
        }
예제 #2
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;
            }
        }