protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.ddlLocation.SelectedValue.Trim().Length > 0)
        {
            this.ddlArea.Items.Clear();
            this.ddlArea.Items.Add(new ListItem("", ""));
            using (_session = new Session())
            {
                Magic.ERP.Core.WHRepository repository = new WHRepository(_session);
                foreach (WHArea area in repository.GetAreas(this.ddlLocation.SelectedValue.Trim()))
                {
                    this.ddlArea.Items.Add(new ListItem(area.Name, area.AreaCode));
                }

                if (this.hidSkuId.Value.Trim().Length > 0)
                {
                    LoadInventoryStock(_session, int.Parse(this.hidSkuId.Value), this.ddlLocation.SelectedValue.Trim(), this.ddlArea.SelectedValue.Trim(), this.ddlSection.SelectedValue);
                }
            }
        }
        else
        {
            this.ddlArea.Items.Clear();
        }
    }
    private void InitialPage()
    {
        using (_session = new Session())
        {
            this.txtMemo.Text = "";
            this.txtStatus.Text = "新建";
            this.txtUser.Text = Magic.Security.SecuritySession.CurrentUser.FullName;
            this.txtInvCheckNumber.Text = "";
            this.ddlLocation.Items.Add(new ListItem(" ", ""));

            WHRepository repository = new WHRepository(_session);
            foreach (WHLocation location in repository.GetLocations())
            {
                TreeNode objNode = new TreeNode() ;
                objNode.Text = location.Name ;
                objNode.Value = location.LocationCode ;
                this.ddlLocation.Items.Add(new ListItem(location.Name, location.LocationCode));
            }

            this.LoadCheckOrder_Item(_session, "");
        }
    }
示例#3
0
    private static SimpleJson InnerLoadWHLocTree(bool fromSelector)
    {
        try
        {
            using (ISession session = new Session())
            {
                WHRepository repository = new WHRepository(session);
                string id = fromSelector ? "whlocationSelector" : "whlocathonTree";
                StringBuilder builder = new StringBuilder();
                builder.Append("<ul id=\"" + id + "\" virtual=\"1\"><li><span ot=\"r\" oi=\"\" pi=\"\">仓库结构</span>");
                builder.Append(@"<ul>");

                #region 处理仓库 WHLocation
                foreach (WHLocation location in repository.GetLocations())
                {
                    builder.Append("<li>");
                    if (fromSelector)
                        builder.Append("<input type='checkbox' style='width:14px;height:14px; border:0; font-size:12px;margin-top:1px;margin-bottom:0;' />");
                    builder.Append("<span ot=\"l\" pi=\"\"")
                        .Append(" oi=\"").Append(location.LocationCode).Append("\"")
                        .Append(">")
                        .Append(location.ToString())
                        .Append("</span>");
                    IList<WHArea> areas = repository.GetAreas(location.LocationCode);
                    #region 处理库位 WHArea
                    if (areas != null && areas.Count > 0)
                    {
                        builder.Append("<ul>");
                        foreach (WHArea area in areas)
                        {
                            builder.Append("<li class=\"closed\">");
                            if (fromSelector)
                                builder.Append("<input type='checkbox' style='width:14px;height:14px; border:0; font-size:12px;margin-top:1px;margin-bottom:0;' />");
                            builder.Append("<span ot=\"a\"")
                                .Append(" oi=\"").Append(area.AreaCode).Append("\"")
                                .Append(" pi=\"").Append(location.LocationCode).Append("\"")
                                .Append(" a_del=\"").Append(area.AllowDelete ? "1" : "0").Append("\"")
                                .Append(" a_sec=\"").Append(area.HasSection ? "1" : "0").Append("\"")
                                .Append(">")
                                .Append(area.ToString())
                                .Append("</span>");
                            IList<WHSection> sections = repository.GetSections(area.AreaCode);
                            #region 处理货架 WHSection
                            if (sections != null && sections.Count > 0)
                            {
                                builder.Append("<ul>");
                                foreach (WHSection section in sections)
                                {
                                    builder.Append("<li>");
                                    if (fromSelector)
                                        builder.Append("<input type='checkbox' style='width:14px;height:14px; border:0; font-size:12px;margin-top:1px;margin-bottom:0;' />");
                                    builder.Append("<span ot=\"s\"")
                                        .Append(" oi=\"").Append(section.SectionCode).Append("\"")
                                        .Append(" pi=\"").Append(section.AreaCode).Append("\"")
                                        .Append(">")
                                        .Append(section.ToString())
                                        .Append("</span>");
                                    builder.Append("</li>");
                                }
                                builder.Append("</ul>");
                            }
                            #endregion
                            builder.Append("</li>");
                        }//foreach (City city in cities)
                        builder.Append("</ul>");
                    }//if (cities.Count > 0)
                    #endregion
                    builder.Append("</li>");
                }//foreach (Province pro in provinces)
                #endregion

                builder.Append("</ul></li></ul>");
                return new SimpleJson(2)
                    .Add("html", builder.ToString())
                    .Add("id", id);
            }
        }
        catch (Exception e)
        {
            log.Error("InnerLoadWHLocTree", e);
            return new SimpleJson().HandleError(e);
        }
    }