private void SetView(WHTransferHead head)
    {
        switch (head.Status)
        {
        case WHTransferStatus.New:
            this.cmdEdit1.Visible  = true;
            this.cmdEdit2.Visible  = true;
            this.cmdClose1.Visible = false;
            this.cmdClose2.Visible = false;
            break;

        case WHTransferStatus.Release:
            this.cmdEdit1.Visible  = false;
            this.cmdEdit2.Visible  = false;
            this.cmdClose1.Visible = false;
            this.cmdClose2.Visible = false;
            break;

        case WHTransferStatus.Open:
            this.cmdEdit1.Visible  = false;
            this.cmdEdit2.Visible  = false;
            this.cmdClose1.Visible = true;
            this.cmdClose2.Visible = true;
            break;

        case WHTransferStatus.Close:
            this.cmdEdit1.Visible  = false;
            this.cmdEdit2.Visible  = false;
            this.cmdClose1.Visible = false;
            this.cmdClose2.Visible = false;
            break;
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.txtAction.Value = WebUtil.Param("mode");
            this.txtId.Value     = WebUtil.Param("ordNumber");

            this.setView(null);

            using (ISession session = new Session())
            {
                IList <WHLocation> locations = WHLocation.EffectiveList(session);
                this.drpFromLocation.Items.Clear();
                this.drpToLocation.Items.Clear();
                foreach (WHLocation loc in locations)
                {
                    this.drpFromLocation.Items.Add(new ListItem(loc.Name, loc.LocationCode));
                    this.drpToLocation.Items.Add(new ListItem(loc.Name, loc.LocationCode));
                }

                if (!this.IsNew)
                {
                    WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
                    this.setView(head);
                    this.showInfo(session, head);
                    log.DebugFormat("PageLoad - {0}移库单: ordNum={1}, return={2}", head.Status == WHTransferStatus.New ? "编辑" : "查看", this.OrderNumber, this.ReturnUrl);
                }
                else
                {
                    log.Debug("PageLoad-新增移库单: return=" + WebUtil.Param("return"));
                }
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        using (ISession session = new Session())
        {
            bool deleted = false;
            try
            {
                session.BeginTransaction();
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    if (chk.Checked && chk.Value.Trim().Length > 0)
                    {
                        WHTransferHead head = WHTransferHead.Retrieve(session, chk.Value.Trim());
                        head.Delete(session);
                        deleted = true;
                    }
                }

                session.Commit();
                if (deleted)
                {
                    WebUtil.ShowMsg(this, "选择的移库单已经删除");
                    this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
                }
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
示例#4
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                WHTransferHead head = null;
                if (this.IsNew)
                {
                    head               = new WHTransferHead();
                    head.OrderNumber   = ERPUtil.NextOrderNumber(WHTransferHead.ORDER_TYPE_NORMAL);
                    head.Note          = this.txtNote.Text.Trim();
                    head.FromLocation  = this.drpFromLocation.SelectedValue;
                    head.ToLocation    = this.drpToLocation.SelectedValue;
                    head.Status        = WHTransferStatus.New;
                    head.OrderTypeCode = WHTransferHead.ORDER_TYPE_NORMAL;
                    head.CreateTime    = DateTime.Now;
                    head.CreateUser    = SecuritySession.CurrentUser.UserId;

                    head.Create(session);
                    log.DebugFormat("Create - 移库单: {0}", head.OrderNumber);

                    System.Text.StringBuilder url = new System.Text.StringBuilder();
                    url.Append("TransferNewLine.aspx?ordNum=").Append(head.OrderNumber);
                    url.Append("&return=");
                    //保存后跳转到添加明细页面
                    //下面的返回url设置用途:
                    //1. 从添加明细页面点击返回按钮,将跳转到明细维护界面
                    //2. 明细维护界面再点击返回按钮,跳转到移库单主档维护页面,并且保留下从移库单主档维护页面进入新增页面时的查询条件
                    url.Append(WebUtil.escape("TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"))));
                    if (log.IsDebugEnabled)
                    {
                        log.DebugFormat("Redirect - to添加移库明细: url={0}", url.ToString());
                        log.DebugFormat("返回移库明细页地址: url={0}", "TransferLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    }
                    this.Response.Redirect(url.ToString());
                }

                head = WHTransferHead.Retrieve(session, this.OrderNumber);
                if (head.Status != WHTransferStatus.New)
                {
                    log.WarnFormat("Warn - 保存移库单: 移库单{0}状态为{1},无法保存", head.OrderNumber, head.Status.ToString());
                    WebUtil.ShowMsg(this, "只有状态为新建的移库单可以修改保存!");
                    return;
                }
                head.Note         = this.txtNote.Text.Trim();
                head.FromLocation = this.drpFromLocation.SelectedValue;
                head.ToLocation   = this.drpToLocation.SelectedValue;
                head.Update(session, "Note", "FromLocation", "ToLocation");
                log.DebugFormat("Update - 移库单: {0}", head.OrderNumber);
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
示例#5
0
    private void showInfo(ISession session, WHTransferHead head)
    {
        User user;

        if (head != null)
        {
            this.txtOrderNumber.Text = head.OrderNumber;
            this.txtNote.Text        = head.Note;
            if (!string.IsNullOrEmpty(head.FromLocation))
            {
                this.drpFromLocation.SelectedValue = head.FromLocation;
            }
            if (!string.IsNullOrEmpty(head.ToLocation))
            {
                this.drpToLocation.SelectedValue = head.ToLocation;
            }

            OrderStatusDef statusDef = OrderStatusDef.Retrieve(session, head.OrderTypeCode, (int)head.Status);
            if (statusDef != null)
            {
                this.lblStatus.Text = statusDef.StatusText;
            }
            if (head.CreateUser > 0)
            {
                user = Magic.Sys.User.Retrieve(session, head.CreateUser);
                if (user != null)
                {
                    this.lblUser.Text = user.FullName;
                }
            }
            this.lblCreateTime.Text    = RenderUtil.FormatDatetime(head.CreateTime);
            this.lblApproveResult.Text = ERPUtil.EnumText <ApproveStatus>(head.ApproveResult);
            switch (head.ApproveResult)
            {
            case ApproveStatus.Reject: this.lblApproveResult.ForeColor = System.Drawing.Color.Red; break;

            case ApproveStatus.Approve: this.lblApproveResult.ForeColor = System.Drawing.Color.Blue; break;
            }
            if (head.ApproveResult == ApproveStatus.Approve || head.ApproveResult == ApproveStatus.Reject)
            {
                if (head.ApproveUser > 0)
                {
                    user = Magic.Sys.User.Retrieve(session, head.ApproveUser);
                    if (user != null)
                    {
                        this.lblApproveUser.Text = user.FullName;
                    }
                }
                this.lblApproveTime.Text = RenderUtil.FormatDatetime(head.ApproveTime);
            }
            this.txtApproveNote.Text = head.ApproveNote;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.txtOrderNumber.Value             = this.OrderNumber;
         this.txtUrlToThisPage.Value           = "TransferLine.aspx?ordNum=" + this.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"));
         this.cmdReturn1["Return"].NavigateUrl = this.cmdReturn2["Return"].NavigateUrl = WebUtil.Param("return");
         using (ISession session = new Session())
         {
             WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
             log.DebugFormat("PageLoad - ÒÆ¿âÃ÷ϸ: ordNum={0}, status={1}", head.OrderNumber, head.Status.ToString());
             this.SetView(head);
             this.QueryAndBindData(session, head);
         }
     }
 }
    private void QueryAndBindData(ISession session, WHTransferHead head)
    {
        this.repeatControl.DataSource = session.CreateObjectQuery(@"
select l.LineNumber as LineNumber,sku.BarCode as BarCode,i.ItemCode as ItemCode,i.ItemName as ItemName
    ,sku.ColorCode as ColorCode,color.ColorText as ColorText,sku.SizeCode as SizeCode
    ,l.FromArea as FromArea,l.FromSection as FromSection,l.ToArea as ToArea,l.ToSection as ToSection
    ,l.MoveQty as MoveQty
from WHTransferLine l
inner join ItemSpec sku on l.SKUID=sku.SKUID
inner join ItemMaster i on i.ItemID=sku.ItemID
left join ItemColor color on color.ColorCode=sku.ColorCode
where l.OrderNumber=?ordNum
order by l.LineNumber")
                                        .Attach(typeof(WHTransferLine))
                                        .Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster)).Attach(typeof(ItemColor))
                                        .SetValue("?ordNum", this.OrderNumber, "l.OrderNumber")
                                        .DataSet();
        this.repeatControl.DataBind();
    }
    private void QueryAndBindData(ISession session, int pageIndex, int pageSize, bool fetchRecordCount)
    {
        int count = 0;

        this._head = WHTransferHead.Retrieve(session, this.OrderNumber);
        this.repeatControl.DataSource = WHTransferHead.Query(session, fetchRecordCount, out count, this._head.FromLocation
                                                             , this.txtSku.Text, this.txtItemCode.Text, this.txtItemName.Text, this.txtColor.Text, this.txtSize.Text, this.drpArea.SelectedValue, this.txtSection.Text
                                                             , pageIndex, pageSize);
        this._session = session;

        this.repeatControl.DataBind();
        this._session = null;
        if (fetchRecordCount)
        {
            this.magicPagerMain.RecordCount = this.magicPagerSub.RecordCount = count;
        }
        WebUtil.SetMagicPager(magicPagerMain, pageSize, pageIndex);
        WebUtil.SetMagicPager(magicPagerSub, pageSize, pageIndex);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         log.DebugFormat("PageLoad - Ìí¼ÓÒÆ¿âÃ÷ϸ: ordNum={0}, return={1}", this.OrderNumber, WebUtil.Param("return"));
         this.toolbarTop["Return"].NavigateUrl = this.toolbarBottom["Return"].NavigateUrl = WebUtil.Param("return");
         using (ISession session = new Session())
         {
             WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
             this.drpArea.Items.Clear();
             this.drpArea.Items.Add(new ListItem("", ""));
             IList <WHArea> areas = ERPUtil.GetWHArea(session, WHTransferHead.ORDER_TYPE_NORMAL, "401", head.FromLocation);
             foreach (WHArea area in areas)
             {
                 this.drpArea.Items.Add(new ListItem(area.AreaCode, area.AreaCode));
             }
             this.QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
         }
     }
 }
示例#10
0
        internal static IApprovable GetApproveItem(ISession session, string orderType, string orderNumber)
        {
            switch (orderType)
            {
            case POHead.ORDER_TYPE:     //采购订单
                return(POHead.Retrieve(session, orderNumber));

            case RCVHead.ORD_TYPE_PUR:           //采购收货
                return(RCVHead.Retrieve(session, orderNumber));

            case POReturnHead.ORD_TYPE_CODE:     //采购退货
                return(POReturnHead.Retrieve(session, orderNumber));

            case ICHead.ORDER_TYPE:     //交接单
                return(ICHead.Retrieve(session, orderNumber));

            case INVCheckHead.ORDER_TYPE_ADJ:     //库存调整单
            case INVCheckHead.ORDER_TYPE_CHK:     //库房盘点
                return(INVCheckHead.Retrieve(session, orderNumber));

            case StockInHead.ORD_TYPE_ASSIST_IN:         //辅料入库
            case StockInHead.ORD_TYPE_ASSIST_OUT:        //辅料领用
            case StockInHead.ORD_TYPE_PRD_IN:            //产品入库
            case StockInHead.ORD_TYPE_PRD_OUT:           //产品领用
                return(StockInHead.Retrieve(session, orderNumber));

            case ReturnHead.ORDER_TYPE_MBR_RTN:       //会员退货
            case ReturnHead.ORDER_TYPE_LOGISTICS_RTN: //物流退货
            case ReturnHead.ORDER_TYPE_INNER_RTN:     //内部退货
            case ReturnHead.ORDER_TYPE_EXCHANGE_RTN:  //会员换货
                return(ReturnHead.Retrieve(session, orderNumber));

            case WHTransferHead.ORDER_TYPE_NORMAL:     //移库单
                return(WHTransferHead.Retrieve(session, orderNumber));
            }
            throw new Exception(string.Format("Order type {0} is not a registered approvable item", orderType));
        }
示例#11
0
    private void setView(WHTransferHead head)
    {
        if (this.IsNew)
        {
            this.cmdDetail.Visible = false;
        }
        else
        {
            this.cmdDetail.Visible = true;
            this.cmdDetail["Detail"].NavigateUrl = "TransferLine.aspx?ordNum=" + this.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(this.ReturnUrl);
            if (head != null && head.Status != WHTransferStatus.New)
            {
                this.cmdEdit.Visible = false;
            }
        }
        this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;

        if (head != null && head.Status != WHTransferStatus.New)
        {
            WebUtil.DisableControl(this.drpFromLocation);
            WebUtil.DisableControl(this.drpToLocation);
            WebUtil.DisableControl(this.txtNote);
        }
    }
示例#12
0
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         #region ɾ³ý
         using (ISession session = new Session())
         {
             try
             {
                 bool deleted = false;
                 session.BeginTransaction();
                 foreach (RepeaterItem item in this.repeatControl.Items)
                 {
                     HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                     if (chk.Checked)
                     {
                         log.DebugFormat("Delete - ÒÆ¿âÃ÷ϸ: ordNum={0}, lineNum={1}", this.OrderNumber, chk.Value);
                         WHTransferLine.Delete(session, this.OrderNumber, chk.Value);
                         deleted = true;
                     }
                 }
                 session.Commit();
                 this.QueryAndBindData(session, WHTransferHead.Retrieve(session, this.OrderNumber));
                 WebUtil.ShowMsg(this, "Ñ¡ÔñµÄÃ÷ϸÒѾ­É¾³ý");
             }
             catch (Exception er)
             {
                 session.Rollback();
                 log.Error("Error - ɾ³ýÒÆ¿âÃ÷ϸ: ", er);
                 WebUtil.ShowError(this, er);
             }
         }
         #endregion
     }
     else if (e.CommandName == "Release")
     {
         #region ·¢²¼
         using (ISession session = new Session())
         {
             try
             {
                 session.BeginTransaction();
                 WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
                 log.DebugFormat("Release - ÒÆ¿âµ¥: {0}", this.OrderNumber);
                 head.Release(session);
                 session.Commit();
                 WebUtil.ShowMsg(this, "·¢²¼³É¹¦");
                 this.QueryAndBindData(session, head);
                 this.SetView(head);
             }
             catch (Exception er)
             {
                 session.Rollback();
                 log.Error("Error - ÒÆ¿âµ¥: ", er);
                 WebUtil.ShowError(this, er);
             }
         }
         #endregion
     }
     else if (e.CommandName == "Close")
     {
         #region ¹Ø±Õ
         using (ISession session = new Session())
         {
             try
             {
                 WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
                 session.BeginTransaction();
                 log.DebugFormat("Close - ÒÆ¿âµ¥: {0}", this.OrderNumber);
                 head.Close(session);
                 session.Commit();
                 WebUtil.ShowMsg(this, string.Format("ÒÆ¿âµ¥{0}ÒѾ­¹Ø±Õ", this.OrderNumber));
                 this.QueryAndBindData(session, head);
                 this.SetView(head);
             }
             catch (Exception er)
             {
                 session.Rollback();
                 log.Error("Error - ÒÆ¿âµ¥: ", er);
                 WebUtil.ShowError(this, er);
             }
         }
         #endregion
     }
 }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Save")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                IList <WHTransferLine> lines = new List <WHTransferLine>();
                WHTransferHead         head  = WHTransferHead.Retrieve(session, this.OrderNumber);
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    TextBox text = item.FindControl("txtMoveQty") as TextBox;
                    decimal qty  = Cast.Decimal(text.Text, 0M);
                    if (qty <= 0M)
                    {
                        continue;
                    }

                    WHTransferLine line = new WHTransferLine();
                    line.MoveQty = qty;
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    line.FromStockID = Cast.Int(chk.Value);
                    HtmlInputText input = item.FindControl("hidTransferQty") as HtmlInputText;
                    qty = Cast.Decimal(input.Value, 0M);
                    if (line.MoveQty > qty)
                    {
                        WebUtil.ShowError(this, "ÒÆ¿âÁ¿±ØÐëСÓÚ»òµÈÓÚ¿ÉÒÆ¿âÁ¿");
                        return;
                    }
                    DropDownList drp = item.FindControl("drpToArea") as DropDownList;
                    line.ToArea    = drp.SelectedValue;
                    text           = item.FindControl("txtToSection") as TextBox;
                    line.ToSection = text.Text.Trim();
                    lines.Add(line);
                }
                if (lines.Count <= 0)
                {
                    log.Debug("Save - ÒÆ¿âÃ÷ϸ: ûÓÐÌîдÒÆ¿âÊýÁ¿£¬Î´Ìí¼ÓÃ÷ϸ");
                    return;
                }

                session.BeginTransaction();
                head.AddLines(session, lines);
                session.Commit();

                log.DebugFormat("Save - ÒÆ¿âÃ÷ϸ: ×ܹ²Ìí¼ÓÁË{0}¸öÒÆ¿âÃ÷ϸ", lines.Count);
                WebUtil.ShowMsg(this, "ÒѾ­´´½¨ÒÆ¿âÃ÷ϸ");
                this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
            }
            catch (Exception er)
            {
                log.Error("Save - ÒÆ¿âÃ÷ϸ: ", er);
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }