//通过主键_获取仓库
function SearchService_Warehouse(wh_id) {
    $.ajax({
        type: "POST",
        contentType: "application/json",
        url: '../../Base/Warehouse/Warehouse_Service.asmx/Get',
        data: "{wh_id:'" + wh_id + "'}",
        dataType: 'json',
        success: function (result) {
            $("#wh_id").val(result.d.wh_id);
            $("#wh_name").val(result.d.wh_name);
            if (action == "Add") return;//新增单据时不进行批量操作
            asyncbox.confirm('是否需要批量设置表体仓库?', '提示', function (buttonResult) {
                if (buttonResult == "ok") {
                    ShowLoadingMask(); //显示遮罩
                    $.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: Main_Service + '/BatchSetWarehouse',
                        data: "{id:'" + id + "',wh_id:'" + wh_id + "'}",
                        dataType: 'json',
                        success: function (result) {
                            HideLoadingMask(); //关闭遮罩
                            if (result.d == "success") {
                                AlertOK("设置成功!");
                                search_grid();
                            } else {
                                AlertNO(result.d);
                            }
                        }
                    });
                }
            });
        }
    });
}
var open_batch_set_department = true;//提示批量设置部门
//通过主键_获取部门
function SearchService_Department(dep_id) {
    $.ajax({
        type: "POST",
        contentType: "application/json",
        url: '../../Base/Department/Department_Service.asmx/Get',
        data: "{dep_id:'" + dep_id + "'}",
        dataType: 'json',
        success: function (result) {
            $("#dep_id").val(result.d.dep_id);
            $("#dep_name").val(result.d.dep_name);
            if (action == "Add") return; //新增单据时不进行批量操作
            if (!open_batch_set_department) 
                return;
            asyncbox.confirm('是否需要批量设置表体部门?', '提示', function (buttonResult) {
                if (buttonResult == "ok") {
                    ShowLoadingMask(); //显示遮罩
                    $.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: Main_Service + '/BatchSetDepartment',
                        data: "{id:'" + id + "',dep_id:'" + dep_id + "'}",
                        dataType: 'json',
                        success: function (result) {
                            HideLoadingMask(); //关闭遮罩
                            if (result.d == "success") {
                                AlertOK("设置成功!");
                                search_grid();
                            } else {
                                AlertNO(result.d);
                            }
                        }
                    });
                }
            });
        }
    });
}