
@{
    ViewData["Title"] = "逻辑仓库";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "库存", "逻辑仓库" };
}

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <input id="isfba" name="isfba" type="hidden" value="0" />
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <label>仓库类型：</label>
                        <select id="warehousetype" name="warehousetype" class="form-control">
                            <option value="">选择仓库类型</option>
                            <option value="国内仓">国内仓</option>
                            <option value="海外仓">海外仓</option>
                            <option value="FBA仓">FBA仓</option>
                            <option value="第三方仓库">第三方仓库</option>
                            <option value="半成品仓">半成品仓</option>
                            <option value="耗材仓">耗材仓</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>仓库：</label>
                        <select id="warehousecode" name="warehousecode" class="form-control" style="width:160px;">
                            <option value="">选择仓库</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label></label>
                        <select id="isfinish" name="isfinish" class="form-control" style="width:160px;">
                            <option value="">选择成品或原料</option>
                            <option value="1">成品</option>
                            <option value="2">原料</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label></label>
                        <select id="category" name="category" class="form-control" style="width:160px;">
                            <option value="">选择产品类型</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
                        <button id="btnexport" style="display:none" type="button" class="btn btn-success" onclick="exportxls()">导出</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="ibox-content m-b-sm border-bottom">
            <table id="roletable" style="table-layout:fixed;"></table>
        </div>
    </div>
</div>
@section css{
    <link href="~/css/bootstrap-table-fixed-columns.css" rel="stylesheet" />
    <style>
        .mules {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
}
@section scripts{
    <script src="~/js/bootstrap-table-fixed-columns.js" type="text/javascript"></script>
    <script type="text/javascript">
        var tb;
        $(document).ready(function () {
            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 160));

            list();

            listwarehouse();

            $('#warehousetype').change(function () {
                listwarehouse();
            })

            $('#isfinish').change(function () {
                if ($(this).val() == '') {
                    $('#category').html('<option value="">产品类型</option>');
                }
                else if ($(this).val() == 1) {  //成品
                    listFinanceCategory();
                }
                else {  //半成品
                    listSemiCategory();
                }
            })

        })

        function list() {
            var columns = [
                {
                    field: 'warehouse_name', title: '存储仓库', width: '190', sortable: true, iscount: true, formatter: function (idx, data) {
                        return '<a href="javascript:;" onclick="SkuDetail(\'' + data.warehouse_code + '\')">' + data.warehouse_name + '</a><img src="@Url.Content("~/img/icon-feed.png")" title="动态库存分析" style="height:20px;margin-left:3px;" onclick="ShowDynamicStock(\'' + data.warehouse_code + '\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'usable_stock', title: '库存数量', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.usable_stock + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="库存数量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'库存数量\',\'usable_stock\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'amount_stock', title: '库存金额', width: '150', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.amount_stock + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="库存金额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'库存金额\',\'amount_stock\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'quantity_purchase', title: '采购在途数量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.quantity_purchase + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="采购在途数量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'采购在途数量\',\'quantity_purchase\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                { field: 'purchase_amount', title: '采购在途金额', width: '130', sortable: true, iscount: true , formatter: function (idx, data) {
                    return data.purchase_amount + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="采购在途金额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'采购在途金额\',\'purchase_amount\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'quantity_transfer', title: '调拨在途数量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.quantity_transfer + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="调拨在途数量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'调拨在途数量\',\'quantity_transfer\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'amount_transit', title: '调拨在途金额', width: '150', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.amount_transit + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="调拨在途金额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'调拨在途金额\',\'amount_transit\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'noshippingcount', title: '待发货数量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.noshippingcount + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="待发货数量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'待发货数量\',\'noshippingcount\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'nostockcount', title: '缺货数量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.nostockcount + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="缺货数量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'缺货数量\',\'nostockcount\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'quantity_tuneout_onway', title: '调出在途数', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.quantity_tuneout_onway + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="调出在途数趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'调出在途数\',\'quantity_tuneout_onway\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'quantity_tuneout_30days', title: '30天调出数', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.quantity_tuneout_30days + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="30天调出数趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天调出数\',\'quantity_tuneout_30days\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'amount_tuneout_30days', title: '30天调出金额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.amount_tuneout_30days + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="30天调出金额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天调出金额\',\'amount_tuneout_30days\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'quantity_tunein_30days', title: '30天调入数', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.quantity_tunein_30days + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="30天调入数趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天调入数\',\'quantity_tunein_30days\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'amount_tunein_30days', title: '30天调入金额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.amount_tunein_30days + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="30天调入金额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天调入金额\',\'amount_tunein_30days\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'oneday_total_sales', title: '昨日总销量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '昨日总销量' + '\',1,\'' + data.warehouse_code + '\')">' + data.oneday_total_sales + '</a>' : data.oneday_total_sales) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="昨日总销量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'昨日总销量\',\'oneday_total_sales\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'amount_onedaysale', title: '昨日总销售额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.amount_onedaysale + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="昨日总销售额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'昨日总销售额\',\'amount_onedaysale\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'sevenday_total_sales', title: '七天销量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '七天销量' + '\',7,\'' + data.warehouse_code + '\')">' + data.sevenday_total_sales + '</a>' : data.sevenday_total_sales) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="七天销量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'七天销量\',\'sevenday_total_sales\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'sevenday_total_sales_amount', title: '七天销售额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '七天销售额' + '\',7,\'' + data.warehouse_code + '\')">' + data.sevenday_total_sales_amount + '</a>' : data.sevenday_total_sales_amount) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="七天销售额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'七天销售额\',\'sevenday_total_sales_amount\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'fourteenday_total_sales', title: '十四天销量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '十四天销量' + '\',14,\'' + data.warehouse_code + '\')">' + data.fourteenday_total_sales + '</a>' : data.fourteenday_total_sales) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="十四天销量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'十四天销量\',\'fourteenday_total_sales\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'fourteenday_total_sales_amount', title: '十四天销售额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '十四天销售额' + '\',14,\'' + data.warehouse_code + '\')">' + data.fourteenday_total_sales_amount + '</a>' : data.fourteenday_total_sales_amount) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="十四天销售额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'十四天销售额\',\'fourteenday_total_sales_amount\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'thirtyday_total_sales', title: '三十天销量', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '三十天销量' + '\',30,\'' + data.warehouse_code + '\')">' + data.thirtyday_total_sales + '</a>' : data.thirtyday_total_sales) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="三十天销量趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'三十天销量\',\'thirtyday_total_sales\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'thirtyday_total_sales_amount', title: '三十天销售额', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return ((data.hq_type != 'FBA仓' && data.hq_type != '半成品仓') ? '<a href="javascript:;" onclick="ShowOrderList(\'' + data.warehouse_name + '三十天销售额' + '\',30,\'' + data.warehouse_code + '\')">' + data.thirtyday_total_sales_amount + '</a>' : data.thirtyday_total_sales_amount) + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="三十天销售额趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'三十天销售额\',\'thirtyday_total_sales_amount\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'cash_in_30days', title: '30天现金流收入', width: '135', sortable: true, iscount: true, formatter: function (idx, data) {
                        return '<a href="javascript:;" onclick="ShowCashFlow(\'' + data.warehouse_code + '\',\''+data.warehouse_name+'\')">' + data.cash_in_30days + '</a><img src="@Url.Content("~/img/icon-trendchart.png")" title="30天现金流收入趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天现金流收入\',\'cash_in_30days\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'cash_out_30days', title: '30天现金流支出', width: '135', sortable: true, iscount: true, formatter: function (idx, data) {
                        return '<a href="javascript:;" onclick="ShowCashFlow(\'' + data.warehouse_code + '\',\'' + data.warehouse_name + '\')">' + data.cash_out_30days + '</a><img src="@Url.Content("~/img/icon-trendchart.png")" title="30天现金流支出趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'30天现金流支出\',\'cash_out_30days\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'cash_net', title: '净值(30d)', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.cash_net + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="净值(30d)趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'净值(30d)\',\'cash_net\',\'' + data.warehouse_name + '\');" />';
                }
                },
                {
                    field: 'pin_rate_stock', title: '动销率%(30d)', width: '160', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.pin_rate_stock + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="动销率%(30d)趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'' + data.warehouse_code + '\',\'动销率%(30d)\',\'pin_rate_stock\',\'' + data.warehouse_name + '\');" />';
                    }
                },
                {
                    field: 'stock_age_6months', title: '半年以上库龄', width: '160', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.stock_age_6months;
                    }
                },
                {
                    field: 'stock_age_6months_amount', title: '半年以上库龄金额', width: '160', sortable: true, iscount: true, formatter: function (idx, data) {
                        return data.stock_age_6months_amount;
                    }
                }
            ];

            var url = '@Url.Content("~/Reports/Warehouse/LogicWarehouseJson")' + '?' + $("#toolbar").serialize();

            if (tb == undefined) {
                tb = OnlyTable("roletable", columns, url, "", {
                    showfooter: true, loadsuccess: function (d) {
                        //替换汇总行的相关列值
                        var tr = $('.fixed-table-footer').find('tr');
                        for (var c in columns) {
                            var key = columns[c].field;
                            if (columns[c].iscount) {
                                for (var v in d.count_row) {
                                    if (key == v) {
                                        if (d.count_row[v] != '总计') {


                                            tr.find('td').eq(c).children('div').first().html(d.count_row[v] + '<img src="@Url.Content("~/img/icon-trendchart.png")" title="总趋势图" style="height:20px;margin-left:3px;" onclick="ShowTrendChart(\'\',\'' + columns[c].title + '的总趋势图\',\'' + v + '\',\'\');" />');
                                        }
                                        else {
                                            tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
                                        }
                                        break;
                                    }
                                }
                            }
                        };

                        if (d.isexport == 1) {
                            $('#btnexport').show();
                        }
                    }
                }, {
                        fixedcol: true,
                        fixedcolnum: 1
                    });
            }
            else {
                tb.bootstrapTable('refresh', { url: url });
            }
        }

        function listwarehouse() {
            var type = $('#warehousetype').val();

            $.submit({
                url: '@Url.Content("~/Home/ListWarehouseFromStockAndSales")',
                paramData: 'warehousetype=' + type,
                type:'POST',
                func: function (result) {
                    if (result != null && result != undefined) {
                        $('#warehousecode').html('<option value="">仓库不限</option>');
                        for (var i = 0; i < result.length; i++) {
                            $('#warehousecode').append('<option value="' + result[i].warehouse_code + '">' + result[i].warehouse_name + '</option>');
                        }
                    }
                }
            })
        }

        //导出
        function exportxls() {
            window.open('@Url.Content("~/Reports/Warehouse/ExportLogicWarehouse?")' + $("#toolbar").serialize(), '_blank');
        }

        function SkuDetail(code) {
            var isfinish = $('#isfinish').val();
            var category = $('#category').val();
            var title = '';

            if (isfinish != '') {
                title == isfinish == 1 ? "成品 " : "半成品 ";
            }
            if (category != '') {
                title += $("#category").find("option:selected").text();
            }

            layer_show(title+' Sku仓库', '@Url.Content("~/Reports/Warehouse/ListWareHouseSku?code=")' + code + '&isfinish=' + + '&category=' + $('#category').val(),'90%','90%');
        }

        function ShowDynamicStock(code, name) {
            var isfinish = $('#isfinish').val();
            var category = $('#category').val();
            var title = '';

            if (isfinish != '') {
                title == isfinish == 1 ? "成品 " : "半成品 ";
            }
            if (category != '') {
                title += $("#category").find("option:selected").text();
            }

            title += ' ';

            layer_show(name + '动态库存分析', '@Url.Content("~/Reports/Warehouse/DynamicStockAnalyse?warehouse_code=")' + code + '&isfinish=' + $('#isfinish').val() + '&category=' + $('#category').val(),'90%','90%');
        }

        function ShowTrendChart(code, name, key, whname) {
            if (code == null) {
                code = '';
            }

            var isfinish = $('#isfinish').val();
            var category = $('#category').val();
            var title = '';

            if (isfinish != '') {
                title == isfinish == 1 ? "成品 " : "半成品 ";
            }
            if (category != '') {
                title += $("#category").find("option:selected").text();
            }

            title += ' ';

            layer_show(title+ whname + "=》" + name + '的趋势图', '@Url.Content("~/Reports/Warehouse/WarehouseTrendChart?warehouse_code=")' + code + '&key=' + key + '&titlename=' + name + '&isfinish=' + $('#isfinish').val() + '&category=' + $('#category').val(),'90%','90%');
        }

        function ShowCashFlow(code,name) {
            layer_show(name + '现金流明细', 'http://aims.bailuntec.com/view/reports/cash-flow-sku.html?warehouse_code=' + code,'90%','90%');
        }

        function ShowOrderList(name,t,warehousecode) {
            var start = '@(ViewBag.StartOneDate)';
            var end = '@(ViewBag.EndDate)';

            if (t == 7) {
                start = '@(ViewBag.StartSevenDate)';
            }
            else if (t == 14) {
                start = '@(ViewBag.StartFourteenDate)';
            }
            else if (t == 30) {
                start = '@(ViewBag.StartThirtyDate)';
            }

            var url = 'http://oms.bailuntec.com/#/bailun-order/all-orders?baseQueryKey=SkuNo_Accurate&dateType=payTime&daterange=' + start + '&daterange=' + end + '&wareNo=' + warehousecode + '&orderStatus=0&orderStatus=1&orderStatus=3';

            layer_show(name + " 的订单明细", url, '90%', '90%');
        }

        var financecategory;
        function listFinanceCategory() {
            if (financecategory == undefined) {
                $.submit({
                    url: '@Url.Content("~/Reports/Warehouse/ListFinanceCategory")',
                    paramData: '',
                    type: 'POST',
                    func: function (result) {
                        if (result != null && result != undefined) {
                            financecategory = result;

                            $('#category').html('<option value="">产品类型</option>');
                            for (var i in financecategory) {
                                $('#category').append('<option value="' + financecategory[i].financecategoryname + '">' + financecategory[i].financecategoryname + '</option>');
                            }
                        }
                    }
                })
            }
            else {
                $('#category').html('<option value="">产品类型</option>');
                for (var i in financecategory) {
                    $('#category').append('<option value="' + financecategory[i].financecategoryname + '">' + financecategory[i].financecategoryname + '</option>');
                }
            }
        }

        var semiCategory;
        function listSemiCategory() {
            if (semiCategory == undefined) {

                $('#category').html('<option value="">产品类型</option>');

                $.submit({
                    url: '@Url.Content("~/Reports/Warehouse/ListSemiSkuCategory")',
                    paramData: '',
                    type: 'POST',
                    func: function (result) {
                        if (result != null && result != undefined) {
                            semiCategory = result;

                            $('#category').html('<option value="">产品类型</option>');
                            for (var i in semiCategory) {
                                $('#category').append('<option value="' + semiCategory[i].product_category_name + '">' + semiCategory[i].product_category_name + '</option>');
                            }
                        }
                    }
                })
            }
            else {
                $('#category').html('<option value="">产品类型</option>');
                for (var i in semiCategory) {
                    $('#category').append('<option value="' + semiCategory[i].product_category_name + '">' + semiCategory[i].product_category_name + '</option>');
                }
            }
        }

    </script>

}


