Пример #1
0
        public static bool Delete(ISession session, string orderNumber)
        {
            INVCheckHead head = INVCheckHead.Retrieve(session, orderNumber);

            if (head != null)
            {
                return(head.Delete(session));
            }
            return(false);
        }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                INVCheckHead head = null;
                if (this.IsNew)
                {
                    head = new INVCheckHead();
                    head.OrderNumber = ERPUtil.NextOrderNumber(INVCheckHead.ORDER_TYPE_ADJ);
                    head.Note = this.txtNote.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    head.Status = INVCheckStatus.New;
                    head.OrderTypeCode = INVCheckHead.ORDER_TYPE_ADJ;
                    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("StockAdjustmentNewLine.aspx?ordNum=").Append(head.OrderNumber);
                    url.Append("&return=");
                    //保存后跳转到添加明细页面
                    //下面的返回url设置用途:
                    //1. 从添加明细页面点击返回按钮,将跳转到明细维护界面
                    //2. 明细维护界面再点击返回按钮,跳转到调整单主档维护页面,并且保留下从调整单主档维护页面进入新增页面时的查询条件
                    url.Append(WebUtil.escape("StockAdjustmentLine.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}", "StockAdjustmentLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    }
                    this.Response.Redirect(url.ToString());
                }

                head = INVCheckHead.Retrieve(session, this.OrderNumber);
                if (head.Status != INVCheckStatus.New)
                {
                    log.WarnFormat("Warn - 保存库存调整单: 库存调整单{0}状态为{1},无法保存", head.OrderNumber, head.Status.ToString());
                    WebUtil.ShowMsg(this, "只有状态为新建的库存调整单可以修改保存!");
                    return;
                }
                head.Note = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.Update(session, "Note", "LocationCode");
                log.DebugFormat("Update - 库存调整单: {0}", head.OrderNumber);
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
 protected void MagicItemCommand(object sender, MagicItemEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         try
         {
             using (ISession session = new Session())
             {
                 try
                 {
                     session.BeginTransaction();
                     INVCheckHead objHead = null;
                     if (this.IsNew)
                     {
                         objHead = new INVCheckHead(this.drpLocation.SelectedValue, Cast.Enum<INVCheckType>(this.drpCheckType.SelectedValue), this.txtMemo.Text.Trim(), SecuritySession.CurrentUser.UserId);
                         objHead.Create(session);
                     }
                     else
                     {
                         objHead = INVCheckHead.Retrieve(session, this.OrderNumber);
                         objHead.Note = this.txtMemo.Text.Trim();
                         objHead.CheckType = Cast.Enum<INVCheckType>(this.drpCheckType.SelectedValue);
                         objHead.Update(session, "CheckType", "Note");
                     }
                     session.Commit();
                     this.Response.Redirect("InventoryCheckWH.aspx?ordNum=" + objHead.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(WebUtil.Param("return")));
                 }
                 catch (Exception ex)
                 {
                     session.Rollback();
                     throw ex;
                 }
             }
         }
         catch (Exception ex)
         {
             logger.Info("保存库存盘点单", ex);
             WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
         }
     }
 }
Пример #4
0
        public static void ConfirmInvCheckOrder(ISession _session, string InvCheckNumber)
        {
            string strSQL = @"
SELECT SUM(A.StockQty) AS StockQty,A.LocationCode AS LocationCode,A.AreaCode AS AreaCode,A.SectionCode AS SectionCode,
        B.SKUID AS SKUID,B.StandardPrice AS Price,B.BasicUnit AS Unit
FROM StockDetail A
LEFT JOIN ItemSpec B ON A.SKUID=B.SKUID
WHERE A.AreaCode In (SELECT AreaCode FROM INVCheckWh WHERE OrderNumber=?)
GROUP BY A.LocationCode,A.AreaCode,A.SectionCode,
        B.SKUID,B.StandardPrice,B.BasicUnit";

            DataSet ds = _session.CreateObjectQuery(strSQL)
                         .Attach(typeof(StockDetail))
                         .Attach(typeof(Magic.Basis.ItemSpec))
                         .Attach(typeof(Magic.Basis.ItemMaster))
                         .Attach(typeof(INVCheckWh))
                         .SetValue(0, InvCheckNumber, EntityManager.GetEntityMapping(typeof(INVCheckWh)).GetPropertyMapping("OrderNumber").DbTypeInfo)
                         .DataSet();

            INVCheckHead objHead = new INVCheckHead();

            objHead.OrderNumber = InvCheckNumber;
            objHead.Status      = INVCheckStatus.Confirm;
            objHead.Update(_session, "Status");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                INVCheckLine objItem = new INVCheckLine();
                objItem.AreaCode     = Cast.String(ds.Tables[0].Rows[i]["AreaCode"]);
                objItem.BeforeQty    = Cast.Decimal(ds.Tables[0].Rows[i]["StockQty"], 0M);
                objItem.CurrentQty   = objItem.BeforeQty;
                objItem.LineNumber   = objHead.NextLineNumber();
                objItem.LocationCode = Cast.String(ds.Tables[0].Rows[i]["LocationCode"]);
                objItem.OrderNumber  = InvCheckNumber;
                objItem.SectionCode  = Cast.String(ds.Tables[0].Rows[i]["SectionCode"]);
                objItem.SKUID        = Cast.Int(ds.Tables[0].Rows[i]["SKUID"], 0);
                objItem.Create(_session);
            }
        }
Пример #5
0
        public static void ConfirmInvCheckOrder(ISession _session,string InvCheckNumber)
        {
            string strSQL = @"
            SELECT SUM(A.StockQty) AS StockQty,A.LocationCode AS LocationCode,A.AreaCode AS AreaCode,A.SectionCode AS SectionCode,
            B.SKUID AS SKUID,B.StandardPrice AS Price,B.BasicUnit AS Unit
            FROM StockDetail A
            LEFT JOIN ItemSpec B ON A.SKUID=B.SKUID
            WHERE A.AreaCode In (SELECT AreaCode FROM INVCheckWh WHERE OrderNumber=?)
            GROUP BY A.LocationCode,A.AreaCode,A.SectionCode,
            B.SKUID,B.StandardPrice,B.BasicUnit";

            DataSet ds = _session.CreateObjectQuery(strSQL)
             .Attach(typeof(StockDetail))
             .Attach(typeof(Magic.Basis.ItemSpec))
             .Attach(typeof(Magic.Basis.ItemMaster))
             .Attach(typeof(INVCheckWh))
             .SetValue(0, InvCheckNumber, EntityManager.GetEntityMapping(typeof(INVCheckWh)).GetPropertyMapping("OrderNumber").DbTypeInfo)
             .DataSet();

            INVCheckHead objHead = new INVCheckHead();
            objHead.OrderNumber = InvCheckNumber;
            objHead.Status = INVCheckStatus.Confirm;
            objHead.Update(_session, "Status");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
               INVCheckLine objItem = new INVCheckLine();
               objItem.AreaCode = Cast.String(ds.Tables[0].Rows[i]["AreaCode"]);
               objItem.BeforeQty = Cast.Decimal(ds.Tables[0].Rows[i]["StockQty"], 0M);
               objItem.CurrentQty = objItem.BeforeQty;
               objItem.LineNumber = objHead.NextLineNumber();
               objItem.LocationCode = Cast.String(ds.Tables[0].Rows[i]["LocationCode"]);
               objItem.OrderNumber = InvCheckNumber;
               objItem.SectionCode = Cast.String(ds.Tables[0].Rows[i]["SectionCode"]);
               objItem.SKUID = Cast.Int(ds.Tables[0].Rows[i]["SKUID"], 0);
               objItem.Create(_session);
            }
        }
    private void SaveCheckOrder()
    {
        try
        {
            DataSet ds = Session["InvAdjustmentItem"] as DataSet;

            Dictionary<int, int> lstCurrentQuantity = new Dictionary<int, int>();
            for (int i = 0; i < this.rptInvCheck.Items.Count; i++)
            {
                TextBox objBox = this.rptInvCheck.Items[i].FindControl("txtCurrentQuantity") as TextBox;
                System.Web.UI.HtmlControls.HtmlInputHidden objSKU = this.rptInvCheck.Items[i].FindControl("hidSKUID") as System.Web.UI.HtmlControls.HtmlInputHidden;
                try
                {
                    lstCurrentQuantity.Add(Cast.Int(objSKU.Value), Cast.Int(objBox.Text));
                }
                catch (Exception ex)
                {
                    WebUtil.ShowMsg(this, "调整数量非法,请重新输入!");
                    return;
                }
            }

            using (_session = new Session())
            {
                _session.BeginTransaction();
                try
                {
                    INVCheckHead objHead = INVCheckHead.Retrieve(_session, this.txtInvCheckNumber.Text);

                    bool blnInsert = false;
                    if (objHead == null)
                    {
                        blnInsert = true;
                        objHead = new INVCheckHead();
                        objHead.CreateTime = DateTime.Now;
                        objHead.CreateUser = Magic.Security.SecuritySession.CurrentUser.UserId;
                        objHead.Note = this.txtMemo.Text;
                        objHead.OrderNumber = Magic.ERP.ERPUtil.NextOrderNumber(Magic.ERP.Orders.INVCheckHead.ORDER_TYPE_ADJ);
                        objHead.OrderTypeCode = INVCheckHead.ORDER_TYPE_ADJ;
                        objHead.Status = Magic.ERP.INVCheckStatus.New;
                        objHead.Create(_session);
                    }
                    else
                    {
                        if ((objHead.Status == Magic.ERP.INVCheckStatus.Release) || (objHead.Status == Magic.ERP.INVCheckStatus.Close))
                        {
                            WebUtil.ShowMsg(this, "发布以后的盘点单不可以进行修改");
                            return;
                        }

                        objHead.Note = this.txtMemo.Text;
                        blnInsert = false;
                        _session.CreateEntityQuery<INVCheckLine>().Where(Exp.Eq("OrderNumber", objHead.OrderNumber)).Delete();
                    }

                    objHead.CurrentLineNumber = "";

                    List<INVCheckLine> List = new List<INVCheckLine>();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        INVCheckLine objLine = new INVCheckLine();
                        objLine.SKUID = Cast.Int(ds.Tables[0].Rows[i]["SKUID"]);
                        objLine.AreaCode = Cast.String(ds.Tables[0].Rows[i]["AreaCode"]);
                        objLine.BeforeQty = Cast.Decimal(ds.Tables[0].Rows[i]["BeforeQty"]);
                        objLine.CurrentQty = lstCurrentQuantity[objLine.SKUID];
                        objLine.LineNumber = objHead.NextLineNumber();
                        objLine.LocationCode = Cast.String(ds.Tables[0].Rows[i]["LocationCode"]);
                        objLine.OrderNumber = objHead.OrderNumber;
                        objLine.SectionCode = Cast.String(ds.Tables[0].Rows[i]["SectionCode"]);
                        objLine.Create(_session);
                    }

                    objHead.Update(_session, "CurrentLineNumber");

                    this.txtInvCheckNumber.Text = objHead.OrderNumber;
                    _session.Commit();
                }
                catch (Exception ex)
                {
                    _session.Rollback();
                    throw ex;
                }
            }
            WebUtil.ShowMsg(this, "库存盘点单保存成功", "操作成功");
        }
        catch (Exception ex)
        {
            logger.Info("保存库存盘点单", ex);
            WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
        }
    }
 private void QueryAndBindData(ISession session, INVCheckHead 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.AreaCode as AreaCode,l.SectionCode as SectionCode,l.BeforeQty as StockQty,l.CurrentQty as AdjQty
     from INVCheckLine 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(INVCheckLine))
         .Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster)).Attach(typeof(ItemColor))
         .SetValue("?ordNum", this.OrderNumber, "l.OrderNumber")
         .DataSet();
     this.repeatControl.DataBind();
 }
    private void SetView(ISession session, INVCheckHead head)
    {
        if (!this.IsNew) WebUtil.DisableControl(this.drpLocation);
        if (head != null)
        {
            if (!string.IsNullOrEmpty(head.LocationCode) && head.LocationCode.Trim().Length > 0)
            {
                WHLocation location = WHLocation.Retrieve(session, head.LocationCode);
                this.drpLocation.Items.Clear();
                this.drpLocation.Items.Add(new ListItem(location.Name, location.LocationCode));
            }
            this.drpCheckType.SelectedValue = head.CheckType.ToString();
            this.txtMemo.Text = head.Note;
            OrderStatusDef statusDef = OrderStatusDef.Retrieve(session, INVCheckHead.ORDER_TYPE_CHK, (int)head.Status);
            if (statusDef != null) this.lblStatus.Text = statusDef.StatusText;
            Magic.Sys.User user = null;
            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);
            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;

            if (head.Status != INVCheckStatus.New)
            {
                WebUtil.DisableControl(this.txtMemo);
                WebUtil.DisableControl(this.drpCheckType);
                this.cmdSave.Visible = false;
            }
        }
    }
Пример #9
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            SaveCheckOrder();
        }

        if (e.CommandName == "Close")
        {
            try
            {
                if (this.txtInvCheckNumber.Text.Trim().Length == 0)
                {
                    WebUtil.ShowMsg(this, "只有签核通过的库存调整单才可以关闭!");
                    return;
                }

                using (_session = new Session())
                {
                    Magic.ERP.Orders.INVCheckHead objhead = Magic.ERP.Orders.INVCheckHead.Retrieve(_session, this.txtInvCheckNumber.Text.Trim());
                    if ((objhead.Status == Magic.ERP.INVCheckStatus.Release) && (objhead.ApproveResult == Magic.ERP.ApproveStatus.Approve))
                    {
                        Magic.ERP.ERPUtil.CommitWHTrans(_session, objhead);
                    }
                    else
                    {
                        WebUtil.ShowMsg(this, "只有签核通过的库存调整单才可以关闭!");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                WebUtil.ShowMsg(this, "关闭库存调整单失败,请与管理员联系!");
            }
        }

        if (e.CommandName == "Insert")
        {
            try
            {
                if (this.hidSkuId.Value.Trim().Length == 0)
                {
                    WebUtil.ShowMsg(this, "请先选择物料!");
                    return;
                }
                string strSKUID       = this.hidSkuId.Value;
                string strLocation    = this.ddlLocation.SelectedValue;
                string strArea        = this.ddlArea.SelectedValue;
                string strSection     = this.ddlSection.SelectedValue;
                int    intNewQuantity = 0;
                try
                {
                    intNewQuantity = int.Parse(this.txtNewQuantity.Text);
                    if (intNewQuantity < 0)
                    {
                        WebUtil.ShowMsg(this, "物料库存数量必须为整数,请重新输入!");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    WebUtil.ShowMsg(this, "物料库存数量必须为整数,请重新输入!");
                    return;
                }

                using (_session = new Session())
                {
                }

                Magic.ERP.Orders.INVCheckLine objLine = new INVCheckLine();
                objLine.AreaCode     = strArea;
                objLine.BeforeQty    = int.Parse(this.txtOldQuantity.Value);
                objLine.CurrentQty   = intNewQuantity;
                objLine.LineNumber   = "";
                objLine.LocationCode = strLocation;
                objLine.OrderNumber  = this.txtInvCheckNumber.Text;
                objLine.SectionCode  = strSection;
                objLine.SKUID        = int.Parse(strSKUID);

                SaveItem(objLine, this.txtItemName.Value, this.txtItemSize.Value, this.txtItemColor.Value, this.ddlLocation.SelectedItem.Text,
                         this.ddlArea.SelectedItem.Text, this.ddlSection.SelectedItem.Text);

                if (this.tblAddItem.Style["display"] == null)
                {
                    this.tblAddItem.Style.Add("display", "none");
                }
                else
                {
                    this.tblAddItem.Style["display"] = "none";
                }

                this.txtItemName.Value         = "";
                this.txtItemColor.Value        = "";
                this.txtItemSize.Value         = "";
                this.ddlLocation.SelectedIndex = 0;
                this.txtOldQuantity.Value      = "0";
                this.txtNewQuantity.Text       = "";
                this.ddlArea.Items.Clear();
                this.ddlSection.Items.Clear();
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                WebUtil.ShowError(this, ex);
            }
        }

        if (e.CommandName == "Return")
        {
            string strURL = "StockAdjustmentManage.aspx";
            if ((WebUtil.Param("return") != null) && (WebUtil.Param("return").Length > 0))
            {
                strURL = WebUtil.Param("return").Trim();
            }
            Response.Redirect(strURL);
        }
    }
 private void SetView(INVCheckHead head)
 {
     this.cmdReturn1["Return"].NavigateUrl = WebUtil.Param("return");
     this.cmdReturn2["Return"].NavigateUrl = WebUtil.Param("return");
     WebUtil.EnableControl(this.drpViewType);
     if (!IsPostBack)
     {
         this.drpViewType.ClearSelection();
         this.drpViewType.SelectedValue = "1";
     }
     if (head == null) return;
     #region ������ť
     switch (head.Status)
     {
         case INVCheckStatus.Confirm:
             this.cmdEdit1.Visible = true;
             this.cmdEdit2.Visible = true;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             if (head.CheckType == INVCheckType.Implicit)
                 WebUtil.DisableControl(this.drpViewType);
             break;
         case INVCheckStatus.Release:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             if (head.ApproveResult == ApproveStatus.Approve)
             {
                 this.cmdClose1.Visible = true;
                 this.cmdClose2.Visible = true;
             }
             else
             {
                 this.cmdClose1.Visible = false;
                 this.cmdClose2.Visible = false;
             }
             if (!IsPostBack)
             {
                 this.drpViewType.ClearSelection();
                 this.drpViewType.SelectedValue = "2";
             }
             break;
         case INVCheckStatus.Close:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             if (!IsPostBack)
             {
                 this.drpViewType.ClearSelection();
                 this.drpViewType.SelectedValue = "2";
             }
             break;
     }
     #endregion
 }
 private void RestoreLastQuery(ISession session, INVCheckHead head)
 {
     QueryHelper helper = new QueryHelper(this);
     if (helper.HasQueryParameter())
     {
         this.drpViewType.SelectedValue = helper.Pop("vt");
         this.drpArea.SelectedValue = helper.Pop("area");
         this.txtSection.Text= helper.Pop("sec");
         this.txtSKU.Text = helper.Pop("sku");
         this.txtItemCode.Text = helper.Pop("itmc");
         this.txtName.Text = helper.Pop("itmn");
         this.txtColor.Text = helper.Pop("color");
         this.txtSize.Text = helper.Pop("size");
     }
     int pageSize = Cast.Int(helper.Pop("ps"), this.magicPagerMain.PageSize);
     int pageIndex = Cast.Int(helper.Pop("pi"), 1);
     this.QueryAndBindData(session, head, pageSize, pageIndex, true);
 }
    private void QueryAndBindData(ISession session, INVCheckHead head, int pageSize, int pageIndex, bool fetchCount)
    {
        Magic.Framework.ORM.Query.ObjectQuery query = session.CreateObjectQuery(string.Format(@"
        select l.LineNumber as LineNumber
        ,s.BarCode as BarCode,m.ItemCode as ItemCode,m.ItemName as ItemName
        ,s.ColorCode as ColorCode,color.ColorText as ColorText,s.SizeCode as SizeCode
        ,l.AreaCode as AreaCode,l.SectionCode as SectionCode,l.BeforeQty as BeforeQty,l.CurrentQty as CurrentQty
        from INVCheckLine l
        inner join ItemSpec s on l.SKUID=s.SKUID
        inner join ItemMaster m on m.ItemID=s.ItemID
        left join ItemColor color on color.ColorCode=s.ColorCode
        where l.OrderNumber=?ordNum {0}
        order by l.LineNumber", this.drpViewType.SelectedValue == "2" ? "and l.BeforeQty<>l.CurrentQty" : ""))
            .Attach(typeof(INVCheckLine)).Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster)).Attach(typeof(ItemColor))
            .SetValue("?ordNum", this.OrderNumber, "l.OrderNumber")
            .SetPage(pageIndex, pageSize);
        if (this.drpArea.SelectedValue.Trim().Length > 0) query.And(Exp.Eq("l.AreaCode", this.drpArea.SelectedValue.Trim()));
        if (this.txtSKU.Text.Trim().Length > 0) query.And(Exp.Like("s.BarCode", "%" + this.txtSKU.Text.Trim() + "%"));
        if (this.txtItemCode.Text.Trim().Length > 0) query.And(Exp.Like("m.ItemCode", "%" + this.txtItemCode.Text.Trim() + "%"));
        if (this.txtName.Text.Trim().Length > 0) query.And(Exp.Like("m.ItemName", "%" + this.txtName.Text.Trim() + "%"));
        if (this.txtColor.Text.Trim().Length > 0) query.And(Exp.Like("s.ColorCode", "%" + this.txtColor.Text.Trim().ToUpper() + "%"));
        if (this.txtSize.Text.Trim().Length > 0) query.And(Exp.Like("s.SizeCode", "%" + this.txtSize.Text.Trim().ToUpper() + "%"));

        this.repeatControl.DataSource = query.DataSet();
        this._head = INVCheckHead.Retrieve(session, this.OrderNumber);
        this.repeatControl.DataBind();
        this._head = null;

        if (fetchCount)
            this.magicPagerMain.RecordCount = this.magicPagerSub.RecordCount = query.Count();
        WebUtil.SetMagicPager(magicPagerMain, pageSize, pageIndex);
        WebUtil.SetMagicPager(magicPagerSub, pageSize, pageIndex);
        this.txtReturnToThisUrl.Value = this.GetReturnUrl();
    }
 private void SetView(INVCheckHead head)
 {
     switch (head.Status)
     {
         case INVCheckStatus.New:
             this.cmdEdit1.Visible = true;
             this.cmdEdit2.Visible = true;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             break;
         case INVCheckStatus.Release:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = true;
             this.cmdClose2.Visible = true;
             break;
         case INVCheckStatus.Close:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             break;
     }
 }
    private void showInfo(ISession session, INVCheckHead head)
    {
        User user;
        if (head != null)
        {
            this.txtOrderNumber.Text = head.OrderNumber;
            this.txtNote.Text = head.Note;
            if (!string.IsNullOrEmpty(head.LocationCode))
                this.drpLocation.SelectedValue = head.LocationCode;

            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;
        }
    }
    private void setView(INVCheckHead head)
    {
        if (this.IsNew)
            this.cmdDetail.Visible = false;
        else
        {
            this.cmdDetail.Visible = true;
            this.cmdDetail["Detail"].NavigateUrl = "StockAdjustmentLine.aspx?ordNum=" + this.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(this.ReturnUrl);
            if (head != null && head.Status != INVCheckStatus.New)
                this.cmdEdit.Visible = false;
        }
        this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;

        if (head != null && head.Status != INVCheckStatus.New)
        {
            WebUtil.DisableControl(this.drpLocation);
            WebUtil.DisableControl(this.txtNote);
        }
    }
 private void SetView(INVCheckHead head)
 {
     if (head == null || head.Status != INVCheckStatus.New)
     {
         this.sectionAdd.Visible = false;
         this.sectionAlert.Visible = false;
         this.cmdConfirm.Visible = false;
         if (head != null)
         {
             this.cmdViewDetail.Visible = true;
             this.cmdViewDetail["Detail"].NavigateUrl = "InventoryCheckDetail.aspx?ordNum=" + head.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(WebUtil.Param("return"));
         }
         else this.cmdViewDetail.Visible = false;
     }
     else this.cmdViewDetail.Visible = false;
     this.cmdReturn["Return"].NavigateUrl = WebUtil.Param("return");
 }
 private void QueryAndBindData(ISession session, INVCheckHead head)
 {
     this.repeaterControl.DataSource = session.CreateObjectQuery(@"
     select 1 from WHArea where AreaCode in (select AreaCode from INVCheckWh where OrderNumber=?ordNum)
     order by AreaCode")
         .Attach(typeof(WHArea)).Attach(typeof(INVCheckWh))
         .SetValue("?ordNum", this.OrderNumber, EntityManager.GetPropMapping(typeof(INVCheckWh), "OrderNumber").DbTypeInfo)
         .List<WHArea>();
     this._head = head;
     this.repeaterControl.DataBind();
     this._head = null;
 }
 private void BindArea(ISession session, INVCheckHead head)
 {
     IList<WHArea> areas = session.CreateObjectQuery(@"
     select 1 from WHArea where AreaCode not in(
     select distinct a.AreaCode
     from INVCheckWh a
     inner join INVCheckHead b on a.OrderNumber=b.OrderNumber
     where b.Status=?s1
     )
     and Status=?status and IsReservedArea=?isReserved and IsTransArea=?transArea and LocationCode=?loc and IsLocked=?islock
     order by AreaCode")
         .Attach(typeof(WHArea)).Attach(typeof(INVCheckWh)).Attach(typeof(INVCheckHead))
         .SetValue("?s1", INVCheckStatus.New, EntityManager.GetPropMapping(typeof(INVCheckHead), "Status").DbTypeInfo)
         .SetValue("?status", WHStatus.Enable, "Status")
         .SetValue("?isReserved", false, "IsReservedArea")
         .SetValue("?transArea", true, "IsTransArea")
         .SetValue("?loc", head.LocationCode, "LocationCode")
         .SetValue("?islock", false, "IsLocked")
         .List<WHArea>();
     this.drpArea.Items.Clear();
     foreach (WHArea area in areas)
         this.drpArea.Items.Add(new ListItem(area.AreaCode, area.AreaCode));
 }